Can't make { } into type integer

Hi all, I am having an issue with my script. I receive an error (number -1700 from { } to integer) about 3/4 of the way through the script, at the point were I want to set the custBug to the object reference of the text box . Any tips would be appreciated. Thanks

tell application “QuarkXPress”
activate
–error checking
set checkVolumes to (list disks)
set textPath to {“Volumes:Public:Customer Artwork:CUST LIBRARY:ENVTXT:”} as string
set statList to {“A- BrushScript”, “B- FranklinGothic”, “C- Souvenir”, “D- UniversityRoman”, “E- Helvetica”, “F- KauflinKoffee”, “G- Optimum”, “H- CopperPlate”}
set stockList to {“CopperPlate”, “Helvetica”, “NewBaskerville”}

if (exists document 1) is true then
	try
		set workpath to ("" & (path to current user folder)) & "Desktop:" as text
		tell application "QuarkXPress"
			set filepath to workpath & "file.qxp"
			save document 1 in filepath version 80
			close document 1 saving no
			delay 2
			tell application "QuarkXPress" to open ((path to desktop) & "file.qxp")
		end tell
	end try
end if

delay 5
tell application "QuarkXPress"
	
	display dialog "Enter Customer Number" with default answer
	set custNumber to text returned of result
	
	tell document "file.qxp"
		set targetBox to {every text box whose selected is true}
	end tell
	if "errNum" = -1728 then
		beep
		display dialog "No text box selected" buttons {"Cancel"} with icon 0 default button 1
		return
		
	end if
	
end tell


tell application "QuarkXPress"
	activate
	set targetPage to targetBox
	set custBug to object reference of (text box whose name is "EN0000") of page targetPage of "file.qxp"
	set targetBug to object reference of ¬
		(text box whose name is "ADDR") of page targetPage of "file.qxp"
	
	set custBug to custNumber

end tell

end tell

–select styles

beep
display dialog " Stationery or Stock Styles?" buttons {“Stationery”, “Stock”}
if button returned of the result is “Stationery” then
set stationeryStyles to item 1 of (choose from list statList with prompt “Stationery” without multiple selections allowed)
else
set stockChoice to item 1 of (choose from list stockList with prompt "Stock " without multiple selections allowed)
end if

–format page

set importStyles to true
set custBug to “EN” & custNumber & “-” & (targetPage as text) as text
set textFormat to textPath & stationeryStyles or stockChoice as text
set targetBox to textPath
set story1 of targetBox to textFormat

Hi Lilacwine70

and welcome on Macscripter. :slight_smile:
Unfortunately, i’m not a user of QuarkXPress, so i can offer some suggestions only.

  1. try to create a structure for your script, e.g. using handlers like:
on get_fonts()
--commands
return result
end get_fonts

.to get a maintainable script. Add furthermore display dialog and log to catch results and bugs.

  1. call QuarkXPress when you’ve particular needs, inherent to this particular app
tell application "QuarkXPress" 
set c_doc to number of documents
if c_doc >0 then
--do something
	close afile saving yes saving in hfs_path
end
end

.in this way your script becomes more efficient.

  1. do some testing prior to use your scripts at work and
    use to format your posts here on Macscripter (text or applescript?) so that everyone reads your scripts with ease.

to answer your question:
Can’t make { } into type integer means:

set textPath to {"Volumes:Public:Customer Artwork:CUST LIBRARY:ENVTXT:"} as string

remove the brackets and the as string. Your path is already a string, because enclose with “”

set textPath to "Volumes:Public:Customer Artwork:CUST LIBRARY:ENVTXT:"

Thanks Joy, I will check into some of your suggestions

Hello

just a detail :

The instruction
set workpath to (“” & (path to current user folder)) & “Desktop:” as text

may be replaced by
set workpath to path to desktop as text

Yvan KOENIG (VALLAURIS, France) jeudi 4 octobre 2012 10:23:52

Thank you for tip, Yvan.