Can't make into type boolean

Hi, I am still fairly new to Applescripting, and I am having a issue with my current script giving and error code at the end of the script. I have pasted the error code.

Result:
error “Can’t make "Volumes:Public:Customer Artwork:CUST LIBRARY:ENVTXT2:F- KauflinKoffee" into type boolean.” number -1700 from “Volumes:Public:Customer Artwork:CUST LIBRARY:ENVTXT2:F- KauflinKoffee” to boolean

I have also included the full script. Any input on how to fix this issue would be great. Thanks

do shell script “echo” password “bibbero” with administrator privileges
tell application “QuarkXPress”
activate
–error checking
set checkVolumes to (list disks)
set textPath to “Volumes:Public:Customer Artwork:CUST LIBRARY:ENVTXT2:”
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 1
		set targetBox to object reference of (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"
	
	if (exists of document 1) then
		set targetPage to targetBox
		
		set custBug to (every text box whose name is "ENVBUG") of page 1 of document 1
		set targetBug to (every text box whose name is "ADDR") of page 1 of document 1
		if custBug is "EN0000" then
			set custBug to custNumber
		end if
	end if
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
tell application “QuarkXPress”
if (exists document 1) then
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
end if
end tell

The error comes from an if-statement but I want to name all faults
1- avoid tell application in a tell application of the same application. Two out of three tell application’s can be removed (middle ones)
2- I can’t make sense of the first line (echo command)
3- in your third if-statement you wrote ‘exist of’ which can’t be done. Use exist like in your first handler or use “<docname” is in name of every document.
4- Your if-statement ‘if “errNum” = -1728 then’ will always be false because you compare a string (which should be a variable I guess) with an integer and will always be false.

Additionally to DJ’s notes the error occurs in this line


 set textFormat to textPath & stationeryStyles or stockChoice as text

or is a boolean operator which can only be used in comparisons

Something else which caught my eye and which probably errors is this:

tell application "QuarkXPress" to open ((path to desktop) & "file.qxp")

Should be:

tell application "QuarkXPress" to open ((path to desktop as text) & "file.qxp")

Or possibly:

tell application "QuarkXPress" to open file ((path to desktop as text) & "file.qxp")

. but I don’t know QuarkXPress’s likes and dislikes.

It would be good if you could wrap your code in this site’s [applescript] and [/applescript] tags when posting it. It causes the code to be displayed with a clickable link as in Stefan’s post and this one.

. and

HFS paths start always with a disk name, unlike
POSIX paths which start with a slash representing the top level of the startup volume

For example
HFS: Public
POSIX: /Volumes/Public
points to the same location

Been away for a few days. Thank you for everyones helpful hints and insight!