Dialog box / bringing Commando+M etc, back)

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)

Dialog box / bringing Commando+M etc, back)

Postby medialog » 18 May 2015, 08:59

Hi

I am making applescript to bring back Commando+M , Command + F etc that has disappeared in >= 10.
Adding a script and have a shortcut for it works 'good enough', but it would be best to have a 'decent dialog box'

I was looking at https://www.bluem.net/en/mac/pashua/ to create that, but I can not figure out how to pass a variable to it
Any suggestions ?
Are there any alternatives (add-ons for applescript, maybe))?

I have put the script at: http://pastie.org/10194882
the problem is line 105.

----------------


tell application "QuarkXPress"
activate
global a

-- This line will ensure a document is open
if not (exists document 1) then error "No document is open."

-- This line ensures a box is selected
if not (exists current box) then error "No box is selected." & return & "Select a box, then run this script again."


-- The following section will get the bounds to use for the grid, and then convert all the values to points

set a to left of bounds of current box
set b to top of bounds of current box
set c to width of bounds of current box
set d to height of bounds of current box

set theChoice to display dialog "left" default answer a
set left of bounds of current box to (text returned of theChoice)

set theChoice to display dialog "top" default answer b
set top of bounds of current box to (text returned of theChoice)

set theChoice to display dialog "bredde" default answer c
set width of bounds of current box to (text returned of theChoice)

set theChoice to display dialog "høyde" default answer d
set height of bounds of current box to (text returned of theChoice)


end tell
medialog
 
Posts: 6
Joined: 18 May 2015, 05:42

Re: Dialog box / bringing Commando+M etc, back)

Postby medialog » 18 May 2015, 10:24

Actually, I have discovered that the problem could lie with:
-------
set a to left of bounds of current box

--------

Althought a dialog box returns this as (for example) "20 mm", there seems to be no way to convert this to a string or int
medialog
 
Posts: 6
Joined: 18 May 2015, 05:42

Re: Dialog box / bringing Commando+M etc, back)

Postby pjanssen » 20 May 2015, 04:41

Since Mac 10.8 something has changed. For certain data types (you have to try yourself which ones) you have to coerce the value directly (!) after the "set" command.

So something like:

Code: Select all
set a to left of bounds of current box
set a_C to (coerce a to string)


For Pashua you have to pass the variables to the sub-routine "getDialogConfiguration". So for e.g. for one variable:

Code: Select all
set dialogConfiguration to my getDialogConfiguration(pashuaLocation, a_C)


and change the first line of the sub-routine to:

Code: Select all
on getDialogConfiguration(pashuaLocation, var1)


To be able to display variable in Pashua change the tfl.default line to:

Code: Select all
tfl.default = " & var1 & "



Btw, when using Pashua I noticed that after changing a script, it's best to save it first before executing. Otherwise you sometimes get an "-4960" error.
pjanssen
 
Posts: 128
Joined: 31 Dec 1969, 19:00


Return to QuarkXPress 8, 9 & 10: AppleScript

Who is online

Users browsing this forum: No registered users and 1 guest