| All times are GMT - 8 Hours |
| #1: |
| Code: |
| -- Set the contents of a field to a value. The image hot spot
-- determines where the click occurs relative to the image -- found location. to setContentsOfField fieldName, fieldValue try Click fieldName TypeCommand "A", "C" -- copy the text contents TypeText fieldValue catch e LogError("Error Clicking Image", e) end try end setContentsOfField |
| Code: |
| -- Grab a field's contents, marked by the image name as the
-- first parameter the image hot spot determines where the -- click occurs relative to the image found location. to contentsOfField fieldName try Click fieldName TypeCommand "A", "C" -- copy the text contents return remoteClipboard(10) catch e LogError("Error Clicking Image", e) end try end contentsOfField |
| #2: |
| Code: |
| params aPrompt, aTitle, anAddress, useLast, allowCancel
-- Remember the last value entered ... if useLast is not a boolean then set useLast to true -- ... and allow cancel by default if allowCancel is not a boolean then set allowCancel to true repeat forever ask aPrompt title aTitle with anAddress -- get our results stored for later use. set ( theResult, email ) to ( the result, it ) if email is empty and theResult is "Cancel" \ and allowCancel then exit repeat if emailIsValid(email) then exit repeat if useLast then set anAddress to email end repeat return email |
| Code: |
| params address
if address is empty then return false split address by "@" if the number of items in address <> 2 then return false set ( name, domain ) to ( items 1 to 2 of address ) -- ensure no inter-word spaces and one word for each if number of words in name <> 1 then return false if number of words in domain <> 1 then return false -- and no outer-word spaces if words 1 to -1 of name <> name then return false if words 1 to -1 of domain <> domain then return false return true |
| Code: |
| AskForValidEmail "Enter Email Address", \
"Destination Email For Reports", \ "errors@yourcompany.com" set validEmailAddress to the result put validEmailAddress |
| EmailValidation.suite.zip | |||
| Description: |
|
Download |
|
| Filename: | EmailValidation.suite.zip | ||
| Filesize: | 31.2 KB | ||
| Downloaded: | 1327 Time(s) | ||
| #3: |
| UnicodeExample.suite.zip | |||
| Description: |
|
Download |
|
| Filename: | UnicodeExample.suite.zip | ||
| Filesize: | 38.64 KB | ||
| Downloaded: | 1298 Time(s) | ||
| #4: |
| Code: |
| ask "Enter pt1" with "1,1"
set pt1 to it ask "Enter pt2" with "3,3" set pt2 to it put pt2 - pt1 --> 5270400, or some time in seconds |
| Code: |
| put yesterday is a date
put tomorrow is a date put "1,1" is a date put "G3" is a date --> all output true |
| Code: |
| to StringToList @vars ...
repeat with each list item in vars by reference split it end repeat return vars end StringToList |
| Code: |
| set ( pt1, pt2 ) to ( "1,1", "3,3" )
StringToList @pt1, @pt2 put pt2 - pt1 |
| Code: |
| set ( pt1, pt2 ) to StringToList( "1,1", "3,3" )
put pt2 - pt1 |
| StringToListExample.suite.zip | |||
| Description: |
|
Download |
|
| Filename: | StringToListExample.suite.zip | ||
| Filesize: | 32.51 KB | ||
| Downloaded: | 1307 Time(s) | ||
| #5: |
| Code: |
| to CharUsageStats string
repeat with each char of string add 1 to r's (it) end repeat return r end CharUsageStats |
| Code: |
| ...
repeat with each word of string ... |
| Code: |
| to ChunkStats string, chunkType
if chunkType is not in ( char, word, line, paragraph ) then set chunkType to char end if -- special case, itemize with split by return & return if chunkType is paragraph then set ( chunkType, delim ) to ( item, return & return ) split string by delim end if -- Send modified code to SenseTalk compiler and runtime. do merge(<< repeat with each [[chunkType]] of string add 1 to r's (it) end repeat>> ) return r end ChunkStats |
| Code: |
| repeat with each item type in ( char, word, line, paragraph )
put ChunkStats(it, type) end repeat |
| #6: |
| Code: |
| to commaFormat number
repeat with n = length of number - 3 down to 1 step 3 put comma after char n of number end repeat return number as text end commaFormat |
| Code: |
| to dollarsAndCents number
set the numberFormat to ".00" set cents to round(number - trunc(number), 2) return "$" & commaFormat(trunc(number)) & last 3 chars of cents end dollarsAndCents |
| Code: |
| set val = "6003905587.190000000"
put dollarsAndCents(val) |
| Code: |
| to dollarsToNumber number
delete all "$" from number delete all "," from number return number end dollarsToNumber |
| Code: |
| repeat 20 times
get dollarsAndCents(randomValue(3,4)) write it && "<->" && dollarsToNumber(it) & return end repeat |
| Code: |
| to randomValue x, y
if x is empty then set x to 5 if y is empty then set y to 2 return random(10^x) & "." & random(10^y) end randomValue |
| #7: |
| FilesExistExamples.suite.zip | |||
| Description: |
|
Download |
|
| Filename: | FilesExistExamples.suite.zip | ||
| Filesize: | 28.68 KB | ||
| Downloaded: | 1264 Time(s) | ||
| #8: |
| ImageOrientationExample.suite.zip | |||
| Description: |
|
Download |
|
| Filename: | ImageOrientationExample.suite.zip | ||
| Filesize: | 117.65 KB | ||
| Downloaded: | 1332 Time(s) | ||
| #9: |
| Code: |
| -- Small script'ette to delete all the cookies in safari
Click (Text: "Safari", TextStyle: ApplicationMenu ) Click ( Text: "Preferences", TextStyle: Menu ) -- or TypeCommand "," Click ( Text: "Security", TextFont: "LucidaGrande", \ TextSize: 11 ) Click ( Text: "Show Cookies", TextFont: "LucidaGrande", \ TextSize: 13 ) get ( Text: "Remove All", TextFont: "LucidaGrande", \ TextSize: 13, Tolerance: 80 ) if ImageFound(30, it) then Click FoundImageLocation() WaitFor 30, ( Text: "Remove All", TextFont: "LucidaGrande", \ TextSize: 13, TextBackgroundColor:(120,167,237)) Click FoundImageLocation() end if Click ( Text: "Done", TextFont: "LucidaGrande", \ TextSize: 13, TextBackgroundColor:(120,167,237)) TypeCommand "w" |
| Code: |
| TypeText commandDown, shiftDown, "g", shiftUp, commandUp
TypeText "/Applications" -- the default path to applications on OS X TypeText return -- makes Finder open a window to previous typed path TypeText "Safari" -- selects the app TypeCommand "o" -- opens up the app |
| Code: |
| Click ( Text: "label", TextStyle: aStyle, HotSpot: offset )
TypeCommand "a" -- select all TypeCommand "x" -- delete all, or could have used TypeText backspace TypeText "newlogin" -- your new login TypeText tab -- tab to the password field TypeText "newpassword" -- your new password TypeText return |
| #10: |
| Code: |
| put FormattedTime("%H:%M:%S", the result's duration seconds)
|
| Code: |
| put the secondsFromGMT / 1 hour
|
| Code: |
| params aTime
return formattedTime("%H:%M:%S", today - 12 hours + aTime) |
| Code: |
| put FormatElapsedTime(3599 seconds) --> 00:59:59
|
Output generated using Printer-Friendly Topic Mod.