text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
on testMethodWithListParas_(parasList) | TestScript.applescript |
log "parasList = " | TestScript.applescript |
log parasList | TestScript.applescript |
set parasListList to parasList as list --将OC中的__NSArrayI转为AppleScript中的 <NSAppleEventDescriptor: 'list'> (即list) | TestScript.applescript |
set str1 to item 1 of parasListList | TestScript.applescript |
set str2 to item 2 of parasListList | TestScript.applescript |
log "str1 = " & str1 & ", " & "str2 = " & str2 | TestScript.applescript |
log "parasList's class = " | TestScript.applescript |
log class of parasList | TestScript.applescript |
end testMethodWithListParas_ | TestScript.applescript |
on testMethodWithDictParas_(parasDict) | TestScript.applescript |
log "parasDict = " | TestScript.applescript |
log parasDict | TestScript.applescript |
set parasRecord to parasDict as record --将OC中的__NSDictionaryI转为 <NSAppleEventDescriptor: 'reco'> (即record) | TestScript.applescript |
set nameStr to theName of parasRecord | TestScript.applescript |
set ageStr to theAge of parasRecord | TestScript.applescript |
log "nameStr = " & nameStr & ", " & "ageStr = " & ageStr | TestScript.applescript |
log "parasDict's class = " | TestScript.applescript |
log class of parasDict | TestScript.applescript |
end testMethodWithDictParas_ | TestScript.applescript |
on testMethodWithNoParas() | TestScript.applescript |
log "No Paras" | TestScript.applescript |
end testMethodWithNoParas | TestScript.applescript |
on run {targetBuddyPhone, targetMessage} | sendimessage.applescript |
set targetService to 1st service whose service type = iMessage | sendimessage.applescript |
set targetBuddy to buddy targetBuddyPhone of targetService | sendimessage.applescript |
send targetMessage to targetBuddy | sendimessage.applescript |
on performSmartRule(selectedRecords) | Replace placeholders.applescript |
repeat with theRecord in selectedRecords | Replace placeholders.applescript |
set t to (type of theRecord) as string | Replace placeholders.applescript |
if t = "markdown" or t = "«constant Ctypmkdn»" then | Replace placeholders.applescript |
set docName to name of theRecord | Replace placeholders.applescript |
set docUUID to uuid of theRecord | Replace placeholders.applescript |
set docURL to reference URL of theRecord as string | Replace placeholders.applescript |
set docFileName to filename of theRecord | Replace placeholders.applescript |
set theGroup to current group | Replace placeholders.applescript |
set groupURL to reference URL of theGroup as string | Replace placeholders.applescript |
set body to plain text of theRecord | Replace placeholders.applescript |
set body to my replace(body, "%UUID%", docUUID) | Replace placeholders.applescript |
set body to my replace(body, "%fileName%", docFileName) | Replace placeholders.applescript |
set body to my replace(body, "%groupURL%", groupURL) | Replace placeholders.applescript |
set body to my replace(body, "%documentURL%", docURL) | Replace placeholders.applescript |
set body to my replace(body, "%documentName%", docName) | Replace placeholders.applescript |
set plain text of theRecord to body | Replace placeholders.applescript |
on error msg number code | Replace placeholders.applescript |
if the code is not -128 then | Replace placeholders.applescript |
on replace(theText, placeholder, value) | Replace placeholders.applescript |
if theText contains placeholder then | Replace placeholders.applescript |
set {od, text item delimiters of AppleScript} to ¬ | Replace placeholders.applescript |
{text item delimiters of AppleScript, placeholder} | Replace placeholders.applescript |
set theText to text items of theText | Replace placeholders.applescript |
set text item delimiters of AppleScript to value | Replace placeholders.applescript |
set theText to "" & theText | Replace placeholders.applescript |
on replace_text(the_text, match, replacement) | TextModifier.applescript |
set text item delimiters to match | TextModifier.applescript |
set temporary_list to text items of the_text | TextModifier.applescript |
set text item delimiters to replacement | TextModifier.applescript |
set finished_form to temporary_list as text | TextModifier.applescript |
return finished_form | TextModifier.applescript |
on wrap_every_text_item(text_items, wrap) | TextModifier.applescript |
repeat with i from 1 to (length of text_items) | TextModifier.applescript |
set item i of text_items to wrap_text(item i of text_items, wrap) | TextModifier.applescript |
end wrap_every_text_item | TextModifier.applescript |
on wrap_text(the_text, wrap) | TextModifier.applescript |
return wrap & the_text & wrap | TextModifier.applescript |
end wrap_text | TextModifier.applescript |
on lower_case(the_text) | TextModifier.applescript |
set upper to "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | TextModifier.applescript |
set lower to "abcdefghijklmnopqrstuvwxyz" | TextModifier.applescript |
return Util's translate_chars(the_text, upper, lower) | TextModifier.applescript |
end lower_case | TextModifier.applescript |
on upper_case(the_text) | TextModifier.applescript |
return Util's translate_chars(the_text, lower, upper) | TextModifier.applescript |
end upper_case | TextModifier.applescript |
on capitalize_text(the_text) | TextModifier.applescript |
set firstChar to upper_case(first character of the_text) | TextModifier.applescript |
set otherChars to lower_case(characters 2 thru -1 of the_text) | TextModifier.applescript |
end capitalize_text | TextModifier.applescript |
on left_side_strip(the_text, trim_string) | TextModifier.applescript |
set x to count trim_string | TextModifier.applescript |
repeat while the_text begins with the trim_string | TextModifier.applescript |
set the_text to characters (x + 1) thru -1 of the_text as text | TextModifier.applescript |
return the_text | TextModifier.applescript |
end left_side_strip | TextModifier.applescript |
on right_side_strip(the_text, trim_string) | TextModifier.applescript |
repeat while the_text ends with the trim_string | TextModifier.applescript |
set the_text to characters 1 thru -(x + 1) of the_text as text | TextModifier.applescript |
end right_side_strip | TextModifier.applescript |
on left_and_right_side_strip(the_text, trim_string) | TextModifier.applescript |
set the_text to left_side_strip(the_text, trim_string) | TextModifier.applescript |
set the_text to right_side_strip(the_text, trim_string) | TextModifier.applescript |
end left_and_right_side_strip | TextModifier.applescript |
script Util | TextModifier.applescript |
on translate_chars(the_text, from_chars, to_chars) | TextModifier.applescript |
set the newText to "" | TextModifier.applescript |
if (count from_chars) is not equal to (count to_chars) then | TextModifier.applescript |
error "translate_chars: From/To strings have different lenght" | TextModifier.applescript |
repeat with char in the_text | TextModifier.applescript |
set newChar to char | TextModifier.applescript |
set x to offset of char in the from_chars | TextModifier.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.