Tips & Tricks Part 2: Add/Remove column

Discuss scripting using AppleScript in QuarkXPress 2015, 2016, 2017 & 2018.
Discuss scripting using JavaScript in QuarkXPress 2018.
Post Reply
pjanssen
Posts: 69
Joined: 31 Dec 1969, 19:00

Tips & Tricks Part 2: Add/Remove column

Post by pjanssen » 30 Nov 2016, 08:38

I created some Applescripts, which might be useful for others too. So I wanted to share them here.

The second one is for adding or removing a column in a text box.

Adding a column:

Code: Select all

try
	tell application "QuarkXPress"
		tell document 1
			get properties of current box
			set SelectedBoxClass to (class of current box) as string
			if SelectedBoxClass is "TXTB" or SelectedBoxClass is "text box" then
				set SelectedBox to object reference of current box
				set SelectedBoxColumns to columns of current box
				if SelectedBoxColumns < 7 then
					set SelectedBoxColumns to SelectedBoxColumns + 1
				end if
				tell SelectedBox
					set columns to SelectedBoxColumns
				end tell
			end if
		end tell
	end tell
end try
Removing a column:

Code: Select all

try
	tell application "QuarkXPress"
		tell document 1
			get properties of current box
			set SelectedBoxClass to (class of current box) as text
			if SelectedBoxClass is "TXTB" or SelectedBoxClass is "text box" then
				set SelectedBox to object reference of current box
				set SelectedBoxColumns to columns of current box
				if SelectedBoxColumns > 1 then
					set SelectedBoxColumns to SelectedBoxColumns - 1
				end if
				tell SelectedBox
					set columns to SelectedBoxColumns
				end tell
			end if
		end tell
	end tell
end try
These scripts are especially useful if a keyboard shortcut is attached to them.

If you own Keyboard Maestro: more useful macros can be found here: viewtopic.php?f=17&t=28981

Post Reply

Return to “QuarkXPress 20xx: Scripting (AppleScript / JavaScript)”