tell application "Finder" set _b to bounds of window of desktop set _w to item 3 of _b set _h to item 4 of _b end tell {_b, _w, _h}
tell application "Finder" set _b to bounds of window of desktop set _w to item 3 of _b set _h to item 4 of _b end tell {_b, _w, _h}
tell application "TextEdit" activate close every document saving no make new document at the beginning of documents set the name of window 1 to "Font Samples" set zoomed of the front window to true set the text of the front document to "The quick brown fox jumped over the lazy dog." tell the text of the front document set the font to "Lucinda Grande" set the size to 24 end tell end tell
(* directory listing*) set thePath to "/" set ergebnis to (do shell script "ls -al "&thePath&" | awk '{print $9}'") as string
set ret to my email_check("yourmail@domain.xy") on email_check(mailadress) -- 29. Mai 2009, 1.55 Uhr, erarbeitet von H =:o) L G I und macmissionar@gmail.com try return (run script (do shell script "perl -nle 'if (/^[^\\,.][A-Z0-9._%+-]+[^\\,.]@[^\\.,](?:[A-Z0-9._%+-]{2,}\\.)[A-Z]{2,4}$/i) {print \"true\"} else {print \"false\"}' <<< " & (quoted form of mailadress))) on error fehler return fehler end try end email_check
(* These examples uses the curl command, see man pages for further details. *) --GET Example property PathToServer : "http://www.qusa.de" set cmd to "curl -s " & quoted form of (PathToServer & "?com=show") set ReturnValue to do shell script cmd --POST Example property PathToServer2 : "http://www.qusa.de" set cmd2 to "curl -s '" & quoted form of (PathToServer2 & "?id=59") & "' -d 'xy=51&name2=value2&press=ok'" set ReturnValue2 to do shell script cmd2
set cmd to "drutil eject" set ReturnValue to do shell script cmd
set the plistfile_path to "~/Desktop/example_2.plist" tell application "System Events" set p_list to property list file (plistfile_path) value of p_list end tell
tell application "System Events" -- create an empty property list dictionary item set the parent_dictionary to make new property list item with properties {kind:record} -- create new property list file using the empty dictionary list item as contents set the plistfile_path to "~/Desktop/example.plist" set pl to make new property list file with properties {contents:parent_dictionary, name:plistfile_path} -- add the values to plist tell pl -- create a text entry make new property list item at end with properties {kind:string, name:"testtext", value:"This is some text"} -- create a truth value entry make new property list item at end with properties {kind:boolean, name:"testbool", value:true} -- create an integer entry make new property list item at end with properties {kind:number, name:"testinteger", value:250} -- create a float / real entry make new property list item at end with properties {kind:number, name:"testfloat", value:123.456789} -- create an empty dictionary set r to make new property list item at end with properties {kind:record, name:"testdictionary"} -- fill that dictionary tell r -- some string whith non ASCII characters make new property list item at end with properties {kind:string, name:"danish_island", value:"XY"} -- some date entry make new property list item at end with properties {kind:date, name:"now", value:current date} -- create an array (or list) make new property list item at end with properties {kind:list, name:"testarray", value:{123, "abc", 100}} end tell end tell end tell (*another example to write an plist-file*) set plistfile_path to "~/Desktop/example_2.plist" set the_record to {testbool:true, testinteger:250, testdictionary:{danish_island:"XY", now:date "Donnerstag, 16. Juni 2011 14:38:04", testarray:{123, "abc", 100}}, testtext:"This is some text", testfloat:123.456789} tell application "System Events" set the parent_dictionary to make new property list item with properties {kind:record, value:the_record} set pl to make new property list file with properties {contents:parent_dictionary, name:plistfile_path} end tell
tell application "System Events" set procs to get every process set procscount to count of procs end tell
if appIsRunning("Safari") then beep -- or do something ;-) end if on appIsRunning(appName) tell application "System Events" to (name of processes) contains appName end appIsRunning