Re: Can not get "item" from "position"
Re: Can not get "item" from "position"
- Subject: Re: Can not get "item" from "position"
- From: Andrei Tchijov <email@hidden>
- Date: Wed, 4 Apr 2007 12:05:38 -0400
YES.
set { x, y } to ...
is exactly what I need!!!
On Apr 4, 2007, at 12:00 PM, has wrote:
Andrei Tchijov wrote:
Now, I want to get to separate items of "position". I though that
the way to do it is
tell application "Finder"
set targetWindow to the front window
item 1 of position of targetWindow
end tell
But it does not work. I am getting error message :
Can't get item 1 of position of Finder window ...
Don't worry, this catches everyone out the first time.
Finder only understands references that identify objects in its
object model, e.g. 'position of front window'. The error occurs
because you ask it to 'get item 1 of position of front window', but
'position of front window' identifies a list value, not an
application object. Finder doesn't know how to manipulate the
contents of values such as strings, lists and records - only
AppleScript knows how to do that - so it raises an error when it
tries to resolve the 'item 1 of' part of the reference.
What you have to do is to get the list from Finder, then use
AppleScript to do the rest. You can do that by inserting your own
'get' command at the appropriate point in the line:
item 1 of (get position of targetWindow)
HTH
has
p.s. If you want to the position list's items to separate 'x' and
'y' variables, the simplest thing is just to write:
set {x, y} to position of targetWindow
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40tchijov.com
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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