• 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
Re: UI referencing a window by number not name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UI referencing a window by number not name


  • Subject: Re: UI referencing a window by number not name
  • From: Mark Butler <email@hidden>
  • Date: Tue, 17 Jan 2006 22:53:33 -0800

Hey Brett,

Before you waste a bunch of time like I did... I couldnt click the print button in Quark so GUI scripting the print dialog was a waste of time. Quark's print command is broken in Tiger so scripting that dosent work. Even before Tiger you couldnt set a custom page size without editing the ppd and taking all the page sizes out. This work around uses the export pdf. You can set the pdf export to only go to ps so it is somewhat useable although I have seen some problems with images in certain rips. You can set in the preferences of Quark to use a post processor for the pdf's so I dont think this touches Jaws (pdf engine Quark uses) at all.

I picked this up somewhere think it was the Quark forums...

on UI_export()
	tell application "QuarkXPress Passport"
		activate
	end tell
	try
		tell application "System Events"
			tell process "QuarkXPress"
				tell menu bar 1
					tell menu bar item "File"
						tell menu "File"
							tell menu item "Export"
								tell menu "Export"
									click menu item "Layout as PDF..."
								end tell
							end tell
						end tell
					end tell
				end tell
				delay 1
				tell window "Export as PDF"
					keystroke (ASCII character 13)
				end tell
			end tell
		end tell
	on error
		display dialog "UI not working"
	end try
end UI_export

Good luck with that freehand thing... Would love to hear what you find out I dont run across those files very often but.. Would be nice to have something in my bag for it...

Mark



On Jan 17, 2006, at 9:43 PM, Brett Conlon wrote:


Hiya,

Scripting is becoming a love/hate relationship... especially when UI scripting and Apps that are AS half-baked AS are involved. Then again, it's probably just me! ;-D

How does one reference a window without having to use the exact name?

I have 2 instances (Quark & FreeHand) where I need to reference a window but the window name is not static, it changes depending on the document name.

Example 1 (QuarkXPress Print window):

If I use the following it works:

click (menu item "A4 Portrait" of menu of pop up button 1 of window "Print Layout 1")

In this case the Layout window in the XPress document is called Layout 1, therefore the Print window is "Print Layout 1". If the XPress Layout window was "Dog" then the Print window would be "Print Dog"

I tried the following but it doesn't like it:

click (menu item "A4 Portrait" of menu of pop up button 1 of window 1)

In desperation I even tried in vain:

click (menu item "A4 Portrait" of menu of pop up button 1 of window whose name starts with "Print")

Example 2 (FreeHand's main window)

I'm simply trying to get the value of the field that sets the documents units at bottom left (Millimetres/Pixels/etc). This works:

get name of pop up button 1 of UI element 8 of window "FHMX Test"

But if I use this it fails:

get name of pop up button 1 of UI element 8 of window 1

In each case I'm using the element reference that is shown in UI Browser.

Is there a special knack to this?

Cheers,

Cojcolds
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


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: This email sent to email@hidden
  • Follow-Ups:
    • Re: UI referencing a window by number not name
      • From: David Hage <email@hidden>
    • Re: UI referencing a window by number not name
      • From: Brett Conlon <email@hidden>
References: 
 >UI referencing a window by number not name (From: Brett Conlon <email@hidden>)

  • Prev by Date: UI referencing a window by number not name
  • Next by Date: Re: UI referencing a window by number not name
  • Previous by thread: UI referencing a window by number not name
  • Next by thread: Re: UI referencing a window by number not name
  • Index(es):
    • Date
    • Thread