hot key to Quark PS

Hi,

Great site, really useful in my first tentative scripting steps :smiley:

Am feeling rather good after compiling my first script as below…

tell application “QuarkXPress™ 4.11”
activate
tell document 1
set DocumentPath to (choose file name with prompt ¬
“Please, set destination and base name for output files…” default name "PS•file ") as string
set PS_file_path to coerce (DocumentPath & “.ps”) to string
set RunLenght to text returned of ¬
(display dialog “Run lenght?..” & return default answer “”) as number
print current page copies RunLenght PostScript file PS_file_path
end tell
end tell

Must admit that I had a good bit of help from butchering someone elses! :slight_smile:
Cheers Ed in Kiev!

Would like to be able to add a hot key to enable me to run the script. I can currently run it from the OSA Menu but would prefer to run from say “Control+P”

I know that I should really get back into my applescript text books and language guide but… I’d really like this running ASAP. Would save LOADS of time with a project at work.

Any pointers???

Ta.

You’ll probably need to use a utility such as QuicKeys to allow you to assign keyboard commands.

– Rob

Assign the script to an F-Key using the keyboard control panel? I like the ease of use of the F-keys, plus it is fun to say “F-key”.

Good idea! There are still things that I miss from the good ol’ pre-OS X days. :slight_smile:

I’m digging xkeys.

Jon

:lol: F-key :lol:

still fun to say

You are a cheap date! :wink:

Thanks for the replies.
(F-key, F-key, F-key, F-key, F-key, F-key, F-key… hee, hee,hee) :rolleyes:

I did consider using F-keys but that takes away some of the shortcut fuctionality of QuarkXpress.

Perhaps one of you ‘senior’ scripters can work out a script (or know of one) that would toggle F-keys on or off so I can quikly switch between the two…??

(Another script I should investigate… but not only am I lazy I’m still in the early days of all this coding stuff!!) :shock: :frowning:

Nice one Jon, xkeys seems like just the job for OS X. Good to keep in mind.

I initially thought that additional code to my script would produce the desired result. I’m aware of a set of scripting additions called Jon’s Commands that seem to refer to being able to detect keystrokes.
In my ignorance I thought that some sort of loop, or code of some sort, would ‘watch’ for a keystroke and run the script.
Am I asking too much of Applescript? (What!)
Is there any other way of coding something to do what I want?
Using a different language perhaps? (What!! again.)
I know that I could be opening a can of worms and really be getting into some hardcore programming but I guess you’ve got to start somewhere… “gulp!?!”
:cry:

Cheers,
Dave

Dave,

If you chose to go with Jon’s “Key’s Pressed” it might look something like the script below. I changed the option & “P” to command - shift - option as holding option -“P” produces a system beep, a very annoying system beep. As far as I can tell command-option-shift is not a part of any of Quark’s keyboard shortcuts but then some Quark guru just may prove me wrong. I couldn’t see anything in the menu’s - holding these three down is silent though.

There are a few drawbacks to doing it this way.

  1. The effect is not always immediate. This script starts over after waiting a second so if you press your keys right after it checks you may have to hold them a little longer. But it does work, and without that annoying beep.

  2. You have to have this script running for it to work. If you took Rob’s advice, and invested in QuicKeys you would not. You shouldn’t see a lag in system performance but be aware that this script will check your keys pressed every so often. But - check it out - see how it performs for you.

Compile and save the following as a stay-open application.

on idle
	--check which keys are pressed
	if (keys pressed) contains "Option" and (keys pressed) contains "Shift" and (keys pressed) contains "Control" then
		my printPSFile() --if command-option-shift are pressed, jump down and perform the printPSFile subroutine
	else
		return 1 --if the keys we are looking for are not pressed check back again in a second
		--you can adjust the amt of time to whatever works for you
	end if
end idle


on printPSFile()
	tell application "QuarkXPress™"
		activate
		tell document 1
			set DocumentPath to (choose file name with prompt ¬
				"Please, set destination and base name for output files…" default name "PS•file ") as string
			set PS_file_path to coerce (DocumentPath & ".ps") to string
			set RunLenght to text returned of ¬
				(display dialog "Run length?..." & return default answer "") as number
			print current page copies RunLenght PostScript file PS_file_path
		end tell
	end tell
end printPSFile

Best regards,

Thanx Mytzl.

On my way home now but I’ll try it in the morning. I think I’ll go down the F-key route and just look into developing a script to toggle between switching F-keys off and on.

Anyone willing to give me a head start on the above? :wink:

Thanks again!

:!: No need. I’ve just tried to see if the keyboard control panel is scriptable. Alas no!

Dave,

You don’t have to disable the F-keys to make your solution work. In the keyboard control panel there is a setting to allow usage of F1 thru F15 which forces the user to press option as a modifier to perform the regular Fkey function. I assigned your script to F7 as in Quark it only toggles the guides. If you really want to toggle the guides on or off just hold option when pressing F7. Otherwise F7 triggers your PrintPS script.

FKey!8^)

Now get some sleep.

Mytzl (you got to have a real name!),

Thanks for the tip, however there are other shortcuts in Quark that use the ‘option F-Key’ (eg option F13 that brings up the ‘Picture Usage window’, I’m always using that. Trapping info, baseline grid, next tool, etc) & these would be disabled.

I’ve come across an alternative to Quickeys called KeyQuencer. :idea:

They do a Lite version thats shareware. Anybody come across it? Do you think this could help me?

I AM VERY HAPPY! :smiley: :smiley: :smiley: :smiley:

Thanks to all who helped! This site has been key in overcoming a very tedious, repetative job.

On a monthly basis using a variable data app we (my colleagues and I) have to PS approx 2000 files. The script and macro app above will make our lives soooooooo much more pleasent.

Cheers!

Dave Pead 8)

PS next I’m gonna try any interigate a spreadsheet to automate input of file names and run lenghts :lol:

Dave,

This seems to be solved but I just wanted to make sure you knew, as well as post for others that may stumble on this thread, that using the F-Key proposal would not affect your option-F13 functions unless you actually assigned something to F13. Nothing is disabled, at least on my computer using Quack 4.1 with a script tied to F7. Actually, now that I really look at it, F1 has nothing assigned to it in Quack 4.1 - I do not have 4.11 so cannot confirm it would be the same for you.

Just thought I’d mention it.

Glad it all worked out!