• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Scripting the unscriptable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting the unscriptable


  • Subject: Scripting the unscriptable
  • From: Elliott Roper <email@hidden>
  • Date: Tue, 26 Jan 2010 19:36:51 +0000

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


 _______________________________________________
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

  • Follow-Ups:
    • Re: Scripting the unscriptable
      • From: Bill Cheeseman <email@hidden>
    • Re: Scripting the unscriptable
      • From: Robert Poland <email@hidden>
  • Prev by Date: Re: Applescript and referring to a folder
  • Next by Date: Send outgoing message error from Mail.app
  • Previous by thread: Subject: Fwd: [mac-dev-jobs] Need Mac Programmer for Text extraction app
  • Next by thread: Re: Scripting the unscriptable
  • Index(es):
    • Date
    • Thread