Re: Scripting the unscriptable
Re: Scripting the unscriptable
- Subject: Re: Scripting the unscriptable
- From: Robert Poland <email@hidden>
- Date: Tue, 26 Jan 2010 14:31:56 -0700
Elliott,
Just a guess;
Preview doesn't have a dictionary. And I suppose position may be a Finder command.
On Jan 26, 2010, at 12:36 PM, Elliott Roper wrote:
> Please can someone tell this newbie why set position and get name work in this script but set bounds doesn't?
>
> if application "Preview" is running then
> tell application "System Events"
> tell application process "Preview"
> set position of window 1 to {-1682, 23}
> get name of window 1
> set bounds of window 1 to {-1682, 23, -9, 1044}
> end tell
> end tell
> end if
>
> Here's the log of events:-
>
> tell application "System Events"
> set position of window 1 of application process "Preview" to {-1682, 23}
> get name of window 1 of application process "Preview"
> --> "Making Use of Python (2002).pdf (page 1 of 416)"
> set bounds of window 1 of application process "Preview" to {-1682, 23, -9, 1044}
> --> error number -1728 from bounds of window 1 of «class pcap» "Preview"
> and the Result:
> error "System Events got an error: Can’t set bounds of window 1 of application process \"Preview\" to {-1682, 23, -9, 1044}." number -10006 from bounds of window 1 of application process "Preview"
>
> I'm guessing that I have a level of indirection wrong among all the 'process' and 'application' stuff, but
> I find that just about all the other properties of window in the process suite of System Events also fail to get or set.
> This is a puzzle to me, because they seem to stand in the same relation to window as position and name do, and they both work.
>
> As you can probably see from the co-ordinates, I'm trying to smarten up my perusal of pdf manuals by hurling them onto my second 20" cinema display and stretching the window to cover the whole screen. (I pasted the values from a recorded script where I placed a Finder window where I want my Preview windows to be) I used to do this by hacking Preview.app's info.plist to convince it to be scriptable (then a tell application "Preview" was all I needed) when Apple clearly do not want it to be. This time, in Snow Leopard, I thought I'd try for a way that does not patch the app folder.
>
> thanks,
> Elliott
Bob Poland - Fort Collins, CO
_______________________________________________
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