Hello,
I have this script that worked in Tiget, but no longer works in Leopard…
See Both Script and Error below…
I have tried to find documentation here, to help me, but can’t find the problem…does anyone know what is in this script that might not be working for Leopard?
thanks!!
babs
on open (myfile)
--10/6/05 added code to process multiple dropped files ending in .qx
set myfile to myfile as string
set suffixloc to offset of ".qx" in myfile
if (length of myfile) - suffixloc > 2 then
set AppleScript's text item delimiters to {".qx"}
set filelist to every text item of myfile
repeat with everyfile in filelist
if length of everyfile > 0 then
set newfile to everyfile & ".qx" as string
processfile(newfile, "drop")
end if
end repeat
else
processfile(myfile, "drop")
end if
end open
on run
--set myfile to choose file with prompt "Select your target"
processfile("", "run")
end run
--Moved further up in process so it didn't try to open a file first.
on processfile(myfile, mymethod)
tell application "QuarkXPress"
activate
try
«event BBRSGLS2»
end try
if mymethod = "drop" then
open file {myfile}
end if
--Added delay 9/30/05 to try to allow for slow opening of documents on server.
try
delay 5
end try
end tell
set myname to "Rebeca"
set datestring to (current date) as string
if datestring contains "January" then set currmonth to "1"
if datestring contains "February" then set currmonth to "2"
if datestring contains "March" then set currmonth to "3"
if datestring contains "April" then set currmonth to "4"
if datestring contains "May" then set currmonth to "5"
if datestring contains "June" then set currmonth to "6"
if datestring contains "July" then set currmonth to "7"
if datestring contains "August" then set currmonth to "8"
if datestring contains "September" then set currmonth to "9"
if datestring contains "October" then set currmonth to "10"
if datestring contains "November" then set currmonth to "11"
if datestring contains "December" then set currmonth to "12"
set currdate to word 3 of datestring
set curryear to word 4 of datestring
set mydate to currmonth & "/" & currdate & "/" & curryear as string
set mytime to word 5 of datestring & ":" & word 6 of datestring & ":" & word 7 of datestring & " " & word 8 of datestring as string
(*tell application "Extensis Suitcase X1"
activate
end tell*)
tell application "QuarkXPress"
--Code added by VivaLaData Feb 12 04 to avoid missing graphics.
try
if auto picture import of document 1 is auto import off then
set auto picture import of document 1 to auto import on
display dialog "I turned auto import picture on."
end if
end try
select text box 1 of document 1
set totalpics to count picture box of document 1
set imageblurb to ""
set fontlist to font list of document 1
set myfonts to ""
set totalfonts to count item of fontlist
repeat with eachfont from 1 to totalfonts
set fontname to name of item eachfont in fontlist
if length of myfonts > 0 then set myfonts to myfonts & ", " as string
set myfonts to myfonts & fontname as string
end repeat
set newfontline to "FONTS: " & myfonts & "
"
repeat with x from 1 to totalpics
if missing of image 1 of picture box x of document 1 then display dialog "An image is missing."
set imagepath to (file path of image 1 of picture box x of document 1 as string)
if imagepath does not contain "slug" and imagepath does not contain "null" then
set imagepath to file path of image 1 of picture box x of document 1 as string
set imagescale to scale of image 1 of picture box x of document 1 as list
set imagescale to (item 1 of imagescale) as string
--Code added Feb.12.04 by VivaLaData to screen out smaller dup logo.
if imagepath contains "T&Co.Logo" and imagescale = "80%" then
else
tell me
set text item delimiters to ":"
set imagename to text item -1 of imagepath
set text item delimiters to " "
end tell
if length of imageblurb > 0 then set imageblurb to imageblurb & ", " as string
set imageblurb to imageblurb & imagename & " @ " & imagescale as string
end if
end if
end repeat
--set imageblurb to ""
set newimageline to "IMAGES: " & imageblurb & (ASCII character 13) as string
set totaltext to count text box of document 1
repeat with x from 1 to totaltext
if (word 1 of text box x of document 1) = "DIVISION" then
set mytext to text of text box x of document 1
tell me
set text item delimiters to "IMAGES:"
set boxpart1 to text item 1 of mytext
set boxpart2 to text item 2 of mytext
set text item delimiters to "TRAFFIC:"
set trafficbox to text item 2 of boxpart2
set text item delimiters to "PRODUCTION:"
set trafficguy to text item 1 of trafficbox
set text item delimiters to "¢Please"
set endbox to text item 2 of trafficbox
set text item delimiters to " "
end tell
set newtrafficline to (ASCII character 13) & "TRAFFIC:" & trafficguy & "PRODUCTION: " & myname
set mytext to boxpart1 & newimageline & newfontline & newtrafficline & (ASCII character 13) & (ASCII character 13) & "¢Please" & endbox as string
set text of text box x of document 1 to mytext
set font of text of text box x of document 1 to "SterlingText-HTF-Roman"
set size of text of text box x of document 1 to "8"
--Removed bolding 10/6/05 to speed up script
(*repeat with eachword from 1 to (count word of text of text box x of document 1)
set alabel to word eachword of text of text box x of document 1
--This "if" screens out the term "Spot color" from being bolded as a label.
if alabel begins with "SPOT" then
set eachword to eachword + 2
set alabel to word eachword of text of text box x of document 1
end if
if alabel begins with "DIVISION" or alabel begins with "JOB" or alabel starts with "PUB" or alabel starts with "DATE" or alabel starts with "SIZE" or alabel starts with "DESCRIPTION" or alabel starts with "CATEGORY" or alabel starts with "SKU" or alabel starts with "IMAGES" or alabel starts with "FONTS" or alabel starts with "TRAFFIC" or alabel starts with "PRODUCTION" or alabel starts with "COLOR" or alabel starts with "SPACE" then
set font of word eachword of text of text box x of document 1 to "SterlingText-HTF-bold"
if alabel begins with "PRODUCTION" then exit repeat
end if
end repeat *)
end if
--if (text of text box x of document 1 as string) contains (name of document 1 as string) then
if (text of text box x of document 1 as string) contains (".qx") then
set text of text box x of document 1 to (name of document 1 as string) & "
" & mydate & " - " & mytime
set font of text of text box x of document 1 to "SterlingText-HTF-Roman"
set size of text of text box x of document 1 to "8"
end if
end repeat
save document 1
end tell
--Added delays to try to keep Quark from tripping over itself.
try
delay 5
end try
(*try
tell application "QuarkXPress"
print document 1
end tell
end try
try
delay 5
end try
tell application "QuarkXPress"
close document 1 saving no
end tell*)
--9/30/05 Added a 5 second pause to try to keep multiple documents from running over each other.
try
delay 5
end try
end processfile
Here is the Error-
Can’t make <<data FX% 00000100>> into type string.
Thanks!!
babs