Hey there, Really new, and dont really know much about applescript.
I am piecing together some stuff to automate some repetitive things that i do. i am having trouble running a script as it says that it cannot make the file into a type file…
Here it is…
MAIN SCRIPT
global mmNumber
--parse xml
set theFinalValues to {}
set XMLfile to "Macintosh HD:Users:Admin:Desktop:jobs.xml"
tell application "System Events"
tell XML element "Main" of contents of XML file XMLfile
repeat with thisOrder from 1 to (count of XML elements)
set orderID to (value of XML attribute of XML element thisOrder) as string
set artistName to (value of (XML elements whose name is "artist") of XML element thisOrder) as string
set orderNumber to (value of (XML elements whose name is "orderNumber") of XML element thisOrder) as string
set mmNumber to (value of (XML elements whose name is "mmNumber") of XML element thisOrder) as string
set nameText to (value of (XML elements whose name is "name") of XML element thisOrder) as string
set actualWidth to (value of (XML elements whose name is "muralWidth") of XML element thisOrder) as string
set actualHeight to (value of (XML elements whose name is "muralHeight") of XML element thisOrder) as string
set crop to (value of (XML elements whose name is "crop") of XML element thisOrder) as string
set crop1_x to (value of (XML elements whose name is "crop1_x") of XML element thisOrder) as string
set crop1_y to (value of (XML elements whose name is "crop1_y") of XML element thisOrder) as string
set crop2_x to (value of (XML elements whose name is "crop2_x") of XML element thisOrder) as string
set crop2_y to (value of (XML elements whose name is "crop2_y") of XML element thisOrder) as string
set crop3_x to (value of (XML elements whose name is "crop3_x") of XML element thisOrder) as string
set crop3_y to (value of (XML elements whose name is "crop3_y") of XML element thisOrder) as string
set crop4_x to (value of (XML elements whose name is "crop4_x") of XML element thisOrder) as string
set crop4_y to (value of (XML elements whose name is "crop4_y") of XML element thisOrder) as string
set theFinalValues to theFinalValues & {{orderID, artistName, orderNumber, mmNumber, nameText, actualWidth, actualHeight, crop, crop1_x, crop1_y, crop2_x, crop2_y, crop3_x, crop3_y, crop4_x, crop4_y}}
repeat with thisData from 1 to count theFinalValues
set orderNumber to item 3 of item thisData of theFinalValues
set artistName to item 2 of item thisData of theFinalValues
set mmNumber to item 4 of item thisData of theFinalValues
set nameText to item 5 of item thisData of theFinalValues
set actualWidth to item 6 of item thisData of theFinalValues
set actualHeight to item 7 of item thisData of theFinalValues
set crop to item 8 of item thisData of theFinalValues
set crop1_x to item 9 of item thisData of theFinalValues
set crop1_y to item 10 of item thisData of theFinalValues
set crop2_x to item 11 of item thisData of theFinalValues
set crop2_y to item 12 of item thisData of theFinalValues
set crop3_x to item 13 of item thisData of theFinalValues
set crop3_y to item 14 of item thisData of theFinalValues
set crop4_x to item 15 of item thisData of theFinalValues
set crop4_y to item 16 of item thisData of theFinalValues
set theFinalSearchValue to {(item 1 of item thisData of theFinalValues), artistName, orderNumber, mmNumber, nameText, actualWidth, actualHeight, crop, crop1_x, crop1_y, crop2_x, crop2_y, crop3_x, crop3_y, crop4_x, crop4_y}
end repeat
set scriptPath to "Users:admin:Desktop:Scripting:Scripts:findMasterFile.scpt"
set x to load script file scriptPath
run x
then the code goes on to compete more steps…
This is the findMasterFile.scpt file
global mmNumber
set targetFolder to "/Users/Admin/Desktop/"
property the_path : "/Volumes/MYW LIBRARY/MASTER FILES"
set theFiles to findFiles(mmNumber, the_path)
repeat with theFilePath in theFiles
do shell script "cp " & quoted form of POSIX path of theFiles & " " & quoted form of targetFolder
end repeat
on findFiles(searchName, directoryToSearchIn)
try
return every paragraph of (do shell script "mdfind -onlyin " & quoted form of directoryToSearchIn & " -name " & quoted form of searchName)
on error
--probably grep didn't found anything
return {}
end try
end findFiles
If i paste the second script into the area i am looking to run it, i get errors that its looking for an end or something… not sure what i am doing…