Re: trying out UI browser and example
Re: trying out UI browser and example
- Subject: Re: trying out UI browser and example
- From: Axel Luttgens <email@hidden>
- Date: Sat, 5 Jun 2010 10:40:04 +0200
Le 5 juin 2010 à 10:02:49, Yuma Antoine Decaux a écrit :
> Ok so here is what i did for the mouse location:
>
> tell application "Extra Suites"
> set MouseLocal to get string of (ES mouse location)
> end tell
> display dialog MouseLocal
>
> And i get an error message saying : can't get string of {883, 345}
So, the command "ES mouse location" returns a list of two integers, very likely an horizontal and a vertical screen coordinate.
But such a list doesn't have a "string" property, hence the run-time error.
You could thus try something like:
tell application "Extra Suites"
set MouseLocal to (ES mouse location)
end tell
display dialog "" & item 1 of MouseLocal & ", " & item 2 of MouseLocal
or:
tell application "Extra Suites"
set {mouseH, mouseV} to (ES mouse location)
end tell
display dialog "" & mouseH & ", " & mouseV
or even:
tell application "Extra Suites"
set MouseLocal to (ES mouse location)
end tell
set AppleScript's text item delimiters to ", "
display dialog MouseLocal as string
I you haven't already done, it could prove useful to download the language guide:
http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/AppleScriptLangGuide/AppleScriptLanguageGuide.pdf
since AppleScript comes with some subtleties. ;-)
> The mouse location is shown in the error message but not in a dialog box as i asked it.
Yes, because the error occurred before the "display dialog" command and halted the script.
> The thing is that it compiles fine but gets error on run.
Because the compiler doesn't know, at compile time, what the "ES mouse location" command is supposed to return.
Back to Garage Band.
When running this one in AppleScript Editor:
tell application "System Events"
tell application process "GarageBand"
tell window 1
tell scroll area 2
properties
end tell
end tell
end tell
end tell
and looking at the result pane, it appears that the scroll area has two properties, "position" and "size", that might be of interest to you.
Let's then suppose you need to easily handle each of the coordinates individually:
tell application "System Events"
tell application process "GarageBand"
tell window 1
tell scroll area 2
set {hrz, vrt} to position
set {wdth, hght} to size
end tell
end tell
end tell
end tell
HTH,
Axel
_______________________________________________
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