Reputation: 566
I want to set the contents of the clipboard to a variable. I've done this before, and it should be simple enough, but I'm getting an error.
on checkiPadFinished()
set tempiPadSerial to "b"
tell application "System Events"
tell process "iTunes"
keystroke "c" using {command down}
set tempiPadSerial to the clipboard as string
if firstiPadSerial is tempiPadSerial then
return true
else if firstiPadSerial is "a" then
set firstiPadSerial to the clipboard as string
end if
end tell
end tell
return false
end checkiPadFinished
Earlier in my code I declare global variables
global XXX, yyy, zzz, firstiPadSerial set firstiPadSerial to "a"
The call to checkiPadFinished() looks like:
set doneiPads to my checkiPadFinished()
As far as I can tell everything should work, but instead I'm getting a cryptic error message.
EDIT: without changing anything it's running. I'm at a loss. I wish that I had written down the error message. But I hit the go button for the 10th time and it worked, so I can't even say what the message was.
Upvotes: 1
Views: 6324
Reputation: 11238
Try:
activate application "iTunes"
tell application "System Events"
tell process "iTunes"
select row 15 of outline 1 of scroll area 2 of window "iTunes"
keystroke "c" using {command down}
delay 0.5 -- jackjr300's suggestion
set xxx to the clipboard
end tell
end tell
Upvotes: 1