Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on run {input, parameters}
- -- Press Return
- delay 0.1
- set timeoutSeconds to 1.0
- set uiScript to "keystroke \"
- \" "
- my doWithTimeout(uiScript, timeoutSeconds)
- return input
- end run
- on doWithTimeout(uiScript, timeoutSeconds)
- set endDate to (current date) + timeoutSeconds
- repeat
- try
- run script "tell application \"System Events\"
- " & uiScript & "
- end tell"
- exit repeat
- on error errorMessage
- if ((current date) > endDate) then
- error "Can not " & uiScript
- end if
- end try
- end repeat
- end doWithTimeout
- ______________________________________________________________________
- on run {input, parameters}
- -- ⌘W drücken
- delay 0.15
- set timeoutSeconds to 1.0
- set uiScript to "keystroke \"w\" using command down"
- my doWithTimeout(uiScript, timeoutSeconds)
- return input
- end run
- on doWithTimeout(uiScript, timeoutSeconds)
- set endDate to (current date) + timeoutSeconds
- repeat
- try
- run script "tell application \"System Events\"
- " & uiScript & "
- end tell"
- exit repeat
- on error errorMessage
- if ((current date) > endDate) then
- error "Can not " & uiScript
- end if
- end try
- end repeat
- end doWithTimeout
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement