Hi All,
Im writing a script to automate Quarkxpress and Xdata auto import script.
I got a script from my friend it is as below
--If double clicked
on run
set aFile to «event ScTlstdF» given «class prmp»:"Select the BARCODEFILM files to process" --of type "TEXT"
set fileContents to ""
set fileName to ""
set fileType to ""
try
repeat with i from 1 to count of items in aFile
open for access (item i of aFile)
set fileContents to fileContents & (read (item i of aFile))
close access (item i of aFile)
set AppleScript's text item delimiters to {":"}
set fileName to fileName & last text item of (item i of aFile as text)
set thisFileName to last text item of (aFile as text)
set AppleScript's text item delimiters to ""
if thisFileName does not contain ".TXT" then
beep
display dialog """ & thisFileName & """ & " is an invalid text file." & return & return & "To run VILLAGER(.TXT) the unaltered file name must include the suffix " & "".TXT"" buttons "Cancel" with icon 1 default button 1
end if
set fileName to («event WaynTrim» {".TXT"} given «class tOFF»:fileName)
end repeat
on error errMsg
close access (item i of aFile)
activate
display dialog errMsg
return
end try
processBarcodeOrders(fileName, fileType)
end run
When I run it shows an error on «event ScTlstdF» given «class prmp»:"Select the BARCODEFILM files to process"
I have bolded and underline in the code.
Does anyone knows why this error?
Please help
Im writing a script to automate Quarkxpress and Xdata auto import script.
I got a script from my friend it is as below
--If double clicked
on run
set aFile to «event ScTlstdF» given «class prmp»:"Select the BARCODEFILM files to process" --of type "TEXT"
set fileContents to ""
set fileName to ""
set fileType to ""
try
repeat with i from 1 to count of items in aFile
open for access (item i of aFile)
set fileContents to fileContents & (read (item i of aFile))
close access (item i of aFile)
set AppleScript's text item delimiters to {":"}
set fileName to fileName & last text item of (item i of aFile as text)
set thisFileName to last text item of (aFile as text)
set AppleScript's text item delimiters to ""
if thisFileName does not contain ".TXT" then
beep
display dialog """ & thisFileName & """ & " is an invalid text file." & return & return & "To run VILLAGER(.TXT) the unaltered file name must include the suffix " & "".TXT"" buttons "Cancel" with icon 1 default button 1
end if
set fileName to («event WaynTrim» {".TXT"} given «class tOFF»:fileName)
end repeat
on error errMsg
close access (item i of aFile)
activate
display dialog errMsg
return
end try
processBarcodeOrders(fileName, fileType)
end run
When I run it shows an error on «event ScTlstdF» given «class prmp»:"Select the BARCODEFILM files to process"
I have bolded and underline in the code.
Does anyone knows why this error?
Please help