Problem saving Quark 4 scripts to OSX

I am trying to convert some Quark 4 scripts to osx but they don’t want to save. the script opens a document and replaces the old scans with new ones from a specific folder then saves the document. I have most of the script working but the scans are not replaced, and it wn’t save the file. It gives the error ‘Can’t make some data into the expected type’. It works fine in os9. The two problems seem to be related as the folder paths and saved in variables, if I hardcode the folders it works. I can’t do this because the folders change.

The code I have to save is:

            save in (DestPath & Docname)

where DestPath = the folder to save to and Docname is the name to call it. this is also the way it gets the correct scan it needs. in the result box the path is correct but still gives an error. what do I need to do to get it to save?

I have not scripted in osx and only a little in os9, mostly modifing these scripts for my work, so i’m not sure of the differences in applescript. I need to get these to work so we can upgrade to OSX.

thanks

without trying this myself…

You may want to try
“save in alias (DestPath & Docname)” or “save in ((DestPath & Docname) as alias)” or something like that. Forcing your variables into a path.

I can’t remember the exact syntax, and I am not where I can try this out myself. But what I have noticed about OSX is you have to sometimes be a little more specific than in OS9.

Good luck.

thanks for the reply but still can’t get it to save the result box gives:

set size of story 1 of text box 2 of document 1 to 10
save document 1 in “MacHD:DocOut:Log 2/13/04 24-56”
“QuarkXPress™ got an error: Can’t make some data into the expected type.”

the MacHD:DocOut is the folder it needs to save to and the filename is Log and the date and time so to looks like it is the correct information but it still doesn’t get the scans or save. The reference to where the scans are is also correct and the text that the script also gets from the folders works just fine using the same variables!

The script is used on several computers and the folders are dated so I can’t just hardcode the script even though it seems to work fine if I do.

Any other suggestions would be appreciated

thanks

This works for me:

set the_folder to (path to desktop as string)
set the_file_name to "test.qxd"

tell application "QuarkXPress? 4.11"
    activate
    tell document 1
        save in (the_folder & the_file_name) as file specification
    end tell
end tell

Jon

Still can’t get this script to work, All It does is give
“QuarkXPress™ got an error: Can’t make some data into the expected type.”
even after adding ‘as file specification’ as suggested
Any other suggestions out there?

With an open document, run this script and report the errors (if any):

try
    set the_folder to (path to desktop as string)
    set the_file_name to "test.qxd"
    tell application "QuarkXPress? 4.11"
        activate
        tell document 1
            save in (the_folder & the_file_name) as file specification
        end tell
    end tell
on error the_error
    return the_error
end try
return "Success!"

Also, what version of QXP & Mac OS X are you using?

Jon

Still no joy

I ran the script you suggested and it worked fine, but the script I have doesn’t work.
the event log shows:

save document 1 in “MacHD:Out:test.0223”
“QuarkXPress™ got an error: Can’t make some data into the expected type.”

the code to save is:
tell application “Finder”
move file CurrFile to folder BU with replacing
end tell
if TheVersion = “FOUR” then
save in (DestPath & docname) version vers 40
else
save in (DestPath & docname) version vers 33
end if

I got it to replace the scans correctly so this is the code to save the actual template both this part and the part that saves the log file give the same error. I no longer need it to save in quark 3 format so I can remove the if statement in the code. but it doesn’t work. The move code also doesn’t seem to work either but that is no big deal right now.
I am using Panther (10.3.2) and quark 4.11
thanks for your help

Well, your references are very vague. It would help if you posted complete code instead of snippets. Somewhere along the way you are either referencing a folder/file that doesn’t exist or you are not properly coercing a string to an alias or file reference. Open a new document in QXP and run this script:

try
    set the_folder to "MacHD:Out:"
    get the_folder as alias
    set the_file_name to "test.0223"
    tell application "QuarkXPress? 4.11"
        activate
        tell document 1
            save in (the_folder & the_file_name) as file specification
        end tell
    end tell
on error the_error
    return the_error
end try
return "Success!"

Any errors? If not, then you need to thoroughly check your code for the mistakes I mentioned above.

Jon

OK, I haven’t been able to work on this script in a while but still can’t get it to work. her is a chunk of the code and it does not work in OSX but does in OS9

tell application “Finder”
set Start to name of startup disk
end tell
set Dest to Start & “:Out:”

set MonthList to {“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”}
set Datestring to (current date) as string
set Mth to word 2 of Datestring
set Dday to word 3 of Datestring as string
set Dyear to characters 3 thru 4 of word 4 of Datestring as string
set Dap to word 8 of Datestring as string
if Dap = “AM” then
set Dhour to word 5 of Datestring as string
else
set Dhour to (word 5 of Datestring) + 12 as string
end if
set DMinute to word 6 of Datestring as string

set Loop to 1 as integer
set MonthNumber to 0 as integer
repeat until Loop > 12
set vv to item Loop of MonthList as string
if Mth = vv then
set MonthNumber to Loop
set Loop to 13
end if
set Loop to (Loop + 1)
end repeat
set shortDate to MonthNumber & “/” & Dday & “/” & Dyear & " " & Dhour & “-” & DMinute as string
set timestamp to (current date)

tell application “QuarkXPress™”
activate
tell default document 1
set oldHeight to page height
set oldWidth to page width
set oldAutoTextBox to automatic text box
set xDocMeasure to horizontal measure
set yDocMeasure to vertical measure
set page width to “27.94cm”
set page height to “43.18cm”
set automatic text box to false
set horizontal measure to inches
set vertical measure to inches
end tell
make document at beginning
set docname to “Log” & " " & shortDate
tell document 1
activate
tell every page
make text box at beginning with properties {bounds:{0.5, 0.5, 1.25, 10.5}, name:“Doc Stamp”}
end tell
tell text box “Doc Stamp”
set story 1 to “Log” & return & timestamp
set size of story 1 to 14
set size of word 1 of story 1 to 18
set style of story 1 to bold
end tell
make text box at end with properties {bounds:{1, 1.25, 16.5, 10.5}}
– tell text box 2
– set story 1 to LogText
– set size of story 1 to 10
– end tell
save in (Dest & docname) version vers 40
if PrintOption = “YES” then
print
end if
close saving «constant RMPFno »
end tell

end tell
end open

This is the part of the code that creates a log and saves it. it is a very long script so i removed a large part of it, but this code is the main problem and causes the error when it goes to save it. If I can get this to work, the rest works fine. I didn’t write this code, but I have modified it several times before but have not had this much problems before.