Re: AppleScript-Users Digest - increase the performance of this script
Re: AppleScript-Users Digest - increase the performance of this script
- Subject: Re: AppleScript-Users Digest - increase the performance of this script
- From: KOENIG Yvan <email@hidden>
- Date: Fri, 13 Apr 2012 21:50:25 +0200
Here the instruction
keystroke "ac" using {command down}
behaves well.
You may split it into :
keystroke "a" using {command down}
keystroke "c" using {command down}
When the datas to copy may be long, I use this tip :
keystroke "a" using {command down}
my safeCopy("Safari")
--=====
on safeCopy(theApp)
local tt
(*
Fill the clipboard with a fake string *)
set tt to "All The Things You Could Be By Now If Sigmund Freud’s Wife Was Your Mother, © Charles Mingus"
set the clipboard to tt
(*
Copy the selected item *)
my raccourci(theApp, "c", "c")
tell application theApp to activate
tell application "System Events" to tell process theapp
keystroke "c" using {command down}
end tell
(*
Loop waiting the achievement of the Copy task. *)
repeat 10 times
try
if the clipboard as text is not tt then exit repeat
on error
delay 0.1
end try
end repeat
end safeCopy
--=====
I don't use the instructions triggering menu by their names because they are localization dependant.
Here,
click menu item "Select All" of menu "Edit" of menu bar 1
click menu item "Copy" of menu "Edit" of menu bar 1
must be replaced by :
click menu item "Tout sélectionner" of menu "Édition" of menu bar 1
click menu item "Copier" of menu "Édition" of menu bar 1
Yvan KOENIG (VALLAURIS, France) vendredi 13 avril 2012 21:44:46
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden