***Update i just used the finder to move the file instead *****
a lil bit familiar with POSIX path but when I take a variable (alias) and parse it into a POSIX path it returns some other info
ie
do shell script “mv -f /Users/jbradfield/Desktop/move to pricelists/out/1369-DrugDiscovery.pdf /Volumes/CHEMICON;NAS1/Interdept/Pricelist/Literature Price Lists/Brochures Flyers etc/1369 - Drug Discovery/1369-DrugDiscovery”
“usage: mv [-f | -i | -n] [-v] source target
mv [-f | -i | -n] [-v] source … directory
sh: line 1: NAS1/Interdept/Pricelist/Literature: No such file or directory”
i know that the part causing problems is “CHEMICON;NAS1” however i do not know how to fix it
here is somebackground for the script if this will help
I will also paste the whole script at the end
ok
The script opens an excel file off a network volume
manipulates the data in excel and saves some info as a variable
that is then placed into a pre-exsisting template file on another network volume inside Quark
hope this is not to confusing
then that quark file needs some minor manipulation(hand work) before printing as a PS
that is then PDFed in acrobat
that final PDF file needs to be moved to the original folder from the excel file
everything else works great
the only trouble is the actual moving of the PDF file to the network volume
thanks for any help
set AppleScript’s text item delimiters to “”
set SourceFolder to choose folder with prompt “Choose the Pricelist Folder”
set results to the result
tell application “Finder”
–set targetPath to item SourceFolder as string → Convert the path to a string for later use
set targetPath to quoted form of POSIX path of (SourceFolder as string) –targetPath
–set the_file to (every file of SourceFolder whose name contains “_list.xls”)
set the_file to (first file of SourceFolder whose name contains “_list.xls”)
set the_fileName to the name of the_file
–set theinfo to the result
set shortname to (characters 1 through -10 of the_fileName)
end tell
–set the_file to choose file with prompt “choose pricelist file”
set the_Qfile to “Graphics:New Templates:Pricelist template:Pricelist Template”
–“Graphics:New Templates:Pricelist template:Pricelist Template”
global the_file
global the_Qfile
global the_Copy
–set the_path to path to desktop --“Macintosh HD:Users:jbradfield:Desktop:Make PDF:In:” – the_file
set dest_path to quoted form of POSIX path of targetPath
set the_path to “Macintosh HD:Users:jbradfield:Desktop:move to pricelists:In:”
set out_folder to “Macintosh HD:Users:jbradfield:Desktop:move to pricelists:out:”
–========== Manipulate’s data in excel==============
tell application “Microsoft Excel”
tell Application “Finder” to open alias (the_file as text) – → open the pricelist in excel
try –- try to hide excel while perfoming actions
tell Application “System Events”
set visible of process “Microsoft Excel” to false
end tell
end try
--[color=olive]set the_fileName to the Name of ActiveWorkbook[/color]
[color=blue]Select[/color] [color=blue]Range[/color] "C3" --[color=olive]--->select catalog number column[/color]
[color=blue]Cut[/color] [color=blue]Range[/color] "C3" [color=blue]To[/color] [color=blue]Range[/color] "C11" --[color=olive]--> move catalog number next to quantity[/color]
[color=blue]Select[/color] [color=blue]Range[/color] "C5:C9,C1:C3"
[color=blue]Activate[/color] [color=blue]Range[/color] "R1C1"
[color=blue]Delete[/color] [color=blue]Selection[/color] [color=blue]Shift[/color] [color=blue]xlToLeft[/color] --[color=olive]> delete xtra columns[/color]
[color=blue]Select[/color] [color=blue]Range[/color] "C4"
[color=blue]set[/color] [color=blue]NumberFormat[/color] [color=blue]of[/color] [color=blue]Selection[/color] [color=blue]to[/color] "$#,##0" --[color=olive]--> set to no decimals[/color]
[color=blue]Select[/color] [color=blue]Range[/color] "R1"
[color=blue]Delete[/color] [color=blue]Selection[/color] [color=blue]Shift[/color] [color=blue]xlUp[/color]
[color=blue]Select[/color] [color=blue]Range[/color] "C1:C4"
[color=blue]CopyObject[/color] [color=blue]Selection[/color]
[color=blue]set[/color] [color=green]the_Copy[/color] [color=blue]to[/color] [color=blue]the clipboard[/color] --[color=olive]->store text for use later[/color]
[color=blue]Close[/color] [color=blue]every[/color] [color=blue]Workbook[/color] [color=blue]saving[/color] [color=blue]No[/color] --[color=olive]-> close excel docs[/color]
end tell
tell application “QuarkXPress”
tell application “Finder” to open (the_Qfile as text)
tell front project to set the name of it to “PricesheetPDF”
tell front document
tell story 1 of text box “pricelistcopy” of page 1
set contents to the_Copy – → this is the copy we got from excel
set style sheet to “Product Listing” –> apply Product Listing Style to this text
end tell
do updates
--[color=olive]=========this forces the updates before i run the next part==========[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
--[color=olive]==========put the excel file name in the top right box of every page=======[/color]
[color=blue]tell[/color] [color=blue]story[/color] 1 [color=blue]of[/color] ([color=blue]every[/color] [color=blue]text box[/color] [color=blue]whose[/color] [color=blue]name[/color] [color=blue]is[/color] "literature") --[color=olive]of every page[/color]
[color=blue]set[/color] [color=blue]contents[/color] [color=blue]to[/color] ([color=green]shortname[/color]) [color=blue]as[/color] [color=blue]text[/color]
[color=blue]set[/color] [color=blue]style sheet[/color] [color=blue]to[/color] "Literature"
[color=blue]end[/color] [color=blue]tell[/color]
[color=blue]set[/color] [color=green]pgCount[/color] [color=blue]to[/color] [color=blue]count[/color] [color=blue]of[/color] [color=blue]pages[/color] [color=blue]of[/color] [color=blue]it[/color]
[color=blue]set[/color] [color=blue]current page[/color] [color=blue]to[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]if[/color] [color=blue]first[/color] [color=blue]paragraph[/color] [color=blue]of[/color] [color=blue]story[/color] 1 [color=blue]of[/color] [color=blue]text box[/color] "pricelistcopy" [color=blue]of[/color] [color=blue]page[/color] [color=green]pgCount[/color] [color=blue]is[/color] "" [color=blue]then[/color]
[color=blue]try[/color]
[color=blue]delete[/color] [color=blue]page[/color] [color=green]pgCount[/color]
[color=blue]end[/color] [color=blue]try[/color]
[color=blue]end[/color] [color=blue]if[/color]
[color=blue]end[/color] [color=blue]tell[/color]
end tell
–==========================================
–==========================================
–========== Part 2 ===========================
–==========================================
tell application “QuarkXPress”
tell front document
set the_name to the story 1 of text box “literature” of page 1
end tell
end tell
(* --======Print Postscript File
–set AppleScript’s text item delimiters to “:”
set PS_file_path to (thePath & shortname & “.ps”) as text
print front document PostScript file PS_file_path
delay 20
tell application “Acrobat Distiller 6.0” to Distill PS_file_path – destinationPath SourceFolder
—> this part needs work still
[color=olive] set outfilepath to quoted form of POSIX path of (“Macintosh HD:Users:jbradfield:Desktop:Make PDF:Out:”)
set pdfname to shortname & “.pdf”
set outfile to quoted form of POSIX path of (outfilepath & pdfname) as text
–set outfilename to (the_fileName & “.pdf”) as text
[/color][color=olive]end tell
delay 20
–========move files to correct folder========
do shell script “mv” & outfile & " " & dest_path & pdfname
[/color]*)
set the_delay to display dialog “==== Pausing while you Format ====”
–============this is where we write the PS file and move it to the destination folder=========
–set theDestPath to targetPath
tell application “QuarkXPress”
tell front document
set the_name to story 1 of text box “literature” of page 1
–========= Print Document to PS file ======
set PS_name to (the_name & “.ps”)
print PostScript file (the_path & PS_name)
end tell
end tell
tell application “Finder”
set PS_name to POSIX path of PS_name as text
end tell
– delay 10
tell application “Acrobat Distiller 6.0”
activate
end tell
delay 20
set pdf_file to POSIX path of (out_folder & the_name & “.pdf”)
set the_dest to POSIX path of results & the_name
do shell script "mv -f " & pdf_file & " " & the_dest
–this script was automatically tagged for
–color coded syntax by Script to Markup Code
–written by Jonathan Nathan