Script error 32767? HELP

The apple script that I converted to work with OSX is giving me a funky error 32767. Some please help if you can. The script is below, that all it is to do is open a Quark Xpress 6.5 document, draw a box, delete it and then save and close it. Again if someone could help I would appreciate it greatly.

global fileName
property dfn : ""

on pathName(fileAlias)
	copy fileAlias as string to xx
	copy text item delimiters of AppleScript to savedDelim
	set text item delimiters of AppleScript to {":"}
	set fileName to last text item of xx as string
	set text item delimiters of AppleScript to savedDelim
	set font to Impact
end pathName

on open y
	set b to button returned of (display dialog ¬
		"             Repair QuarkXPressâ„¢ Document
		                    
		                     	
Repair existing documents or retain backups and save new documents?" buttons {"Cancel", "Repair", "Save New"} default button 3)
	if b = "Save New" then
		set destpath to (choose folder with prompt "Select a destination folder for new versions.") as text
	end if
	set x to 1
	repeat number of items in y times
		set docpath to item x of y
		set z to info for item x of y
		if z is not folder then
			if z's file type is not "XPRJ" then
				beep 2
			else
				tell application "QuarkXPress"
					open item x of y use doc prefs yes
					tell document 1
						make text box at beginning
						tell text box 1
							set name to "GlenBox"
							set bounds to {"3 pt", "3 pt", "13 pt", "13 pt"}
						end tell
						delete text box "GlenBox"
						if b = "Save New" then
							my pathName(docpath)
							try
								save in (destpath & fileName)
							on error number -47
								if dfn = "Replace" then
									save
								else
									set dfn to button returned of (display dialog "The original file(s) currently exist(s) in this location.  Do you want to replace the original document(s)?" buttons {"Replace", "Cancel"} default button 2 with icon caution)
									if dfn = "Replace" then save
								end if
							end try
							close
						else if b = "Repair" then
							save
							close
						end if
					end tell
				end tell
			end if
			set x to x + 1
		else
			beep 1
		end if
	end repeat
	with timeout of 600000 seconds
		tell application "QuarkXPress"
			activate
			display dialog "Rock On!" & return & return & "Your Documents Have Been Repaired"
		end tell
	end timeout
end open

I enclosed your script in AppleScript tags.

Where is the error – is a line is highlighted when you try to compile or does it error when you drop a file on it? (It’s a droplet).

Adam,

The error occurs when the document is dropped on the app.

Then I would comment out the “on open” and “end open” statements in my script editor. Replace “on open y” with “set y to choose file” (or the path to one you want to drop) since you won’t be dropping one. Then run the script from the SE so you’ll see where the failure is occurring.

Hi,

I don’t understand the line

set font to Impact

in the subroutine, I guess without a Quark tell block it couldn’t work.
Anyway, the subroutine can be replaced by the name property of info for
and the folder check can’t work this way.
I don’t have Quark, so I couldn’t test is, give this a try

global fileName
property dfn : ""

on open y
    set b to button returned of (display dialog ¬
        "             Repair QuarkXPressâ„¢ Document
                            
                                 
Repair existing documents or retain backups and save new documents?" buttons {"Cancel", "Repair", "Save New"} default button 3)
    if b = "Save New" then
        set destpath to (choose folder with prompt "Select a destination folder for new versions.") as Unicode text
    end if
    repeat with docpath in y
        set {folder:Fo, name:Nm, file type:Ft} to info for docpath
        if Fo is false then
            if Ft is not "XPRJ" then
                beep 2
            else
                tell application "QuarkXPress"
                    open docpath use doc prefs yes
                    tell document 1
                        make text box at beginning
                        tell text box 1
                            set name to "GlenBox"
                            set bounds to {"3 pt", "3 pt", "13 pt", "13 pt"}
                        end tell
                        delete text box "GlenBox"
                        if b = "Save New" then
                            set font to Impact
                            try
                                save in (destpath & Nm)
                            on error number -47
                                if dfn = "Replace" then
                                    save
                                else
                                    set dfn to button returned of (display dialog "The original file(s) currently exist(s) in this location.  Do you want to replace the original document(s)?" buttons {"Replace", "Cancel"} default button 2 with icon caution)
                                    if dfn = "Replace" then save
                                end if
                            end try
                            close
                        else if b = "Repair" then
                            save
                            close
                        end if
                    end tell
                end tell
            end if
        else
            beep 1
        end if
    end repeat
    with timeout of 600000 seconds
        tell application "QuarkXPress"
            activate
            display dialog "Rock On!" & return & return & "Your Documents Have Been Repaired"
        end tell
    end timeout
end open

Adam, Thanks for your help.

Stefan, I was getting a font warning message when the script ran and thought if set the font to something available on the system level it would correct the error.