Just a couple more problems

I seem to be piecing this together bit by but, but right now I’ve run into two issues. One: it asks me for a save location, but doesn’t actually save it there. It’s just saving it wherever the input file comes from. Two: I can’t get it to name the file properly. I would like to grab the original input filename and then append onto that. Right now it is just saving as the first name over and over itself. Any help would be appreciated. Thanks

-- 1)
set chosenfiles to my choosefiles()
if chosenfiles is missing value then
	return
end if
-- 2)
set filepaths to my getfilepaths(chosenfiles)
-- 3)
set outfilenames to my getoutfilenames(chosenfiles)
-- 4)
set OutputFolder to my chooseoutputfolder()
if OutputFolder is missing value then
	return
end if
end run

-- I am asking the user to choose files to process
-- In case the user cancels the dialog, I return «missing value»
on choosefiles()
	try
		set chosenfiles to choose file with prompt "Please choose files to process:" with multiple selections allowed without invisibles
		return chosenfiles
	on error
		return missing value
	end try
end choosefiles

-- I am asking the user to choose an output folder
-- In case the user cancels the dialog, I return «missing value»
on chooseoutputfolder()
	try
		set chosenfolder to choose folder with prompt "Please choose an output folder:" without multiple selections allowed and invisibles
		return chosenfolder
	on error
		return missing value
	end try
end chooseoutputfolder

-- I am turning a list of Finder items (aliases) into a list of file path strings (Mac, not Posix)
on getfilepaths(finderitems)
	set filepaths to {}
	repeat with finderitem in finderitems
		set filepaths to filepaths & (finderitem as Unicode text)
	end repeat
	return filepaths
end getfilepaths

-- I am returning a list of output file names where the extensions are stripped off
on getoutfilenames(finderitems)
	set outfilenames to {}
	repeat with finderitem in finderitems
		set fileinfo to info for finderitem
		set filename to name of fileinfo
		set dotoffset to offset of "." in ((reverse of (characters 1 through -1 of filename)) as Unicode text)
		if dotoffset is greater than 0 then
			set outfilename to ((characters 1 through -(dotoffset + 1) of filename) as Unicode text)
		else
			set outfilename to filename
		end if
		set outfilenames to outfilenames & outfilename
	end repeat
	return outfilenames
end getoutfilenames

--Actual batch sequences start here
--1 through 16 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 1-16" of row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 1-16"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke (outfilenames & "1-16")
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell
--2 through 15
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 15 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 2-15" of row 15 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 2-15"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke (outfilenames & "2-15")
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
		tell process "Acrobat"
			close document
		end tell
	end tell
end tell

Hi,

in your script the variable OutputFolder is set but then never used.
To chose a certain folder in an open/save dialog you have to type ⇧⌘G and then the POSIX(!) path of the folder

Thanks for the help,

How do I key in ⇧ and ⌘?

So what I need to do is key ⇧⌘G then OutputFolder & outfilenames & “(whatever I want to name it)”?

It’s also GUI scripting like this


tell application "System Events"
	keystroke "g" using {command down, shift down}
	repeat until exists sheet 1
		delay 0.5
	end repeat
	tell sheet 1
		keystroke "/path/to/Folder"
		click button "OK"
	end tell
end tell

It is only an example. I don’t know if this really works.
GUI scripting is always trial&error :wink:

OK, I’ve gotten the part where you put in the file path. Now how do I get it to type the filename? I’m trying to recall the variable outfilenames, but it just won’t type anything in. It just totally ignores that line.

-- 1)
set chosenfiles to my choosefiles()
if chosenfiles is missing value then
	return
end if
-- 2)
set filepaths to my getfilepaths(chosenfiles)
-- 3)
set outfilenames to my getoutfilenames(chosenfiles)
-- 4)
set OutputFolder to my chooseoutputfolder()
if OutputFolder is missing value then
	return
end if
end run

-- I am asking the user to choose files to process
-- In case the user cancels the dialog, I return «missing value»
on choosefiles()
	try
		set chosenfiles to choose file with prompt "Please choose files to process:" with multiple selections allowed without invisibles
		return chosenfiles
	on error
		return missing value
	end try
end choosefiles

-- I am asking the user to choose an output folder
-- In case the user cancels the dialog, I return «missing value»
on chooseoutputfolder()
	try
		set chosenfolder to choose folder with prompt "Please choose an output folder:" without multiple selections allowed and invisibles
		return chosenfolder
	on error
		return missing value
	end try
end chooseoutputfolder

-- I am turning a list of Finder items (aliases) into a list of file path strings (Mac, not Posix)
on getfilepaths(finderitems)
	set filepaths to {}
	repeat with finderitem in finderitems
		set filepaths to filepaths & (finderitem as Unicode text)
	end repeat
	return filepaths
end getfilepaths

-- I am returning a list of output file names where the extensions are stripped off
on getoutfilenames(finderitems)
	set outfilenames to {}
	repeat with finderitem in finderitems
		set fileinfo to info for finderitem
		set filename to name of fileinfo
		set dotoffset to offset of "." in ((reverse of (characters 1 through -1 of filename)) as Unicode text)
		if dotoffset is greater than 0 then
			set outfilename to ((characters 1 through -(dotoffset + 1) of filename) as Unicode text)
		else
			set outfilename to filename
		end if
		set outfilenames to outfilenames & outfilename
	end repeat
	return outfilenames
end getoutfilenames

--Actual batch sequences start here
--1 through 16 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 1-16" of row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 1-16"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (outfilenames) & ".1-16"
			delay 20
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell

It looks to me like you’ve got a problem with nested Tells. Generally you don’t want to nest tells inside each other. That might be what’s confusing the script as to what the variable outfilenames contains when you try to keystroke it.

If I can’t use nested tells then I guess I could replace tell application with activate application, but then what can I use in place of tell process? Or, would it work if I just moved them around like so;


tell application "Finder"
   open chosenfiles
   activate application "Adobe Acrobat Professional"
end tell  
tell application "System Events"
   activate process "Acrobat"
           click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
           select row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
           select static text "Publix 16T Crop 1-16" of row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
           click button "Run Sequence" of window "Batch Sequences"
           click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 1-16"
           click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
           keystroke "g" using {command down, shift down}
           keystroke (OutputFolder)
           keystroke return
           keystroke (outfilenames) & ".1-16"
           delay 20
           click button "Save" of window "Save As"
           delay 5
           click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
           delay 2
           click button "Revert" of front window
           click button "Close" of window "Batch Sequences"
end tell

edit: tried that and it gave me an error. tried this and it produced the same result as the original script…

tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
end tell
tell application "System Events"
	tell process "Acrobat"
		click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
		select row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
		select static text "Publix 16T Crop 1-16" of row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
		click button "Run Sequence" of window "Batch Sequences"
		click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 1-16"
		click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
		keystroke "g" using {command down, shift down}
		keystroke (OutputFolder)
		keystroke return
		keystroke (outfilenames) & ".1-16"
		delay 20
		click button "Save" of window "Save As"
		delay 5
		click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
		delay 2
		click button "Revert" of front window
		click button "Close" of window "Batch Sequences"
	end tell
end tell

there are two major problems in the script.

¢ the class of Outputfolder is alias, you need a POSIX string path to select the folder
¢ the class of outfilenames is a list, I don’t know what Acrobat is expecting, but certainly not a list.

There could also be a timing problem after “pressing” ⇧⌘G, the script should wait until the sheet is visible

Thank you for pointing out the problems. I do imagine outfilenames being a list is exactly why Acrobat is ignoring it. So I will do some digging and teach myself how to properly call list items. As for Outputfolder I don’t know how to get the POSIX path, so I suppose I will just look up everything I can regarding POSIX. Thanks for pointing me in the right direction.


.
set OutputFolder to my chooseoutputfolder()
if OutputFolder is missing value then return
set OutputFolder to POSIX path of OutputFolder

-- I am asking the user to choose files to process
.

Thank you for your help. :slight_smile:

edit: I found out that to call an item from a list it’s as easy as “item 1 of (list).” So, thanks to a great deal of help from everyone here, I have finally (somewhat) completed my first script. There is a great deal of optimizing to be done, and I don’t think it would work with multiple input selections, but it does the job! Thanks for everyone’s help. Although it is extremely specific to my application (due to a great deal of GUI scripting, and the nature of the script), here is a script that ties together multiple Acrobat batch processes.

-- 1)
set chosenfiles to my choosefiles()
if chosenfiles is missing value then
	return
end if
-- 2)
set filepaths to my getfilepaths(chosenfiles)
-- 3)
set outfilenames to my getoutfilenames(chosenfiles)
-- 4)
set OutputFolder to my chooseoutputfolder()
if OutputFolder is missing value then
	return
end if
set OutputFolder to POSIX path of OutputFolder
end run

-- Asking the user to choose files to process
-- In case the user cancels the dialog, return «missing value»
on choosefiles()
	try
		set chosenfiles to choose file with prompt "Please choose files to process:" with multiple selections allowed without invisibles
		return chosenfiles
	on error
		return missing value
	end try
end choosefiles

-- Asking the user to choose an output folder
-- In case the user cancels the dialog, return «missing value»
on chooseoutputfolder()
	try
		set chosenfolder to choose folder with prompt "Please choose an output folder:" without multiple selections allowed and invisibles
		return chosenfolder
	on error
		return missing value
	end try
end chooseoutputfolder

-- Returning a list of Finder items (aliases) into a list of file path strings (Mac, not Posix)
on getfilepaths(finderitems)
	set filepaths to {}
	repeat with finderitem in finderitems
		set filepaths to filepaths & (finderitem as Unicode text)
	end repeat
	return filepaths
end getfilepaths

-- Returning a list of output file names where the extensions are stripped off
on getoutfilenames(finderitems)
	set outfilenames to {}
	repeat with finderitem in finderitems
		set fileinfo to info for finderitem
		set filename to name of fileinfo
		set dotoffset to offset of "." in ((reverse of (characters 1 through -1 of filename)) as Unicode text)
		if dotoffset is greater than 0 then
			set outfilename to ((characters 1 through -(dotoffset + 1) of filename) as Unicode text)
		else
			set outfilename to filename
		end if
		set outfilenames to outfilenames & outfilename
	end repeat
	return outfilenames
end getoutfilenames

--Actual batch sequences start here
--1 through 16 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 1-16" of row 14 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 1-16"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".1-16"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell

--2 through 15 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 15 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 2-15" of row 15 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 2-15"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".2-15"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell

--3 through 14 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 16 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 3-14" of row 16 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 3-14"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".3-14"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell


--4 through 13 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 17 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 4-13" of row 17 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 4-13"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".4-13"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell


--5 through 12 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 18 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 5-12" of row 18 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 5-12"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".5-12"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell


--6 through 11 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 19 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 6-11" of row 19 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 6-11"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".6-11"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell


--8 through 9 
tell application "Finder"
	open chosenfiles
	activate application "Adobe Acrobat Professional"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row 21 of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop 8-9" of row 21 of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop 8-9"
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke ".8-9"
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end tell
	end tell
end tell


beep 3

edit2: Well, it runs when in the script editor, but won’t run as an application. It keeps giving me the error “end of <> doesn’t understand the run message.” I’m obviously forgetting some sort of run command, I guess. Could someone give me one more little nudge?

Sorry for the double post, but I wanted to bump it in hopes that someone could help me with the final problem.

It runs when in the script editor, but won’t run as an application. It keeps giving me the error “end of <> doesn’t understand the run message.” I’m obviously forgetting some sort of run command, I guess.

Hi,

I guess the “end run” line causes the error, it’s not needed unless you have an explicit “on run” line at the beginning
I cleaned up your script a bit using a repeat loop for the batch sequence, unfortunately I can’t test it because I don’t have your sequence.

Two notes:
in each iteration you tell the Finder to open all files, I reduced it to once.
you take always only the first name of the file name list, is this intended?


property CropList : {"1-16", 2-15, "3-14", "4-13", "5-12", "6-11", "7-10", "8-9"}

-- 1)
set chosenfiles to (choose file with prompt "Please choose files to process:" with multiple selections allowed without invisibles)
-- 2)
-- set filepaths to paragraphs of chosenfiles
-- 3)
set outfilenames to getoutfilenames(chosenfiles)
-- 4)
set OutputFolder to POSIX path of (choose folder with prompt "Please choose an output folder:" without invisibles)

--Actual batch sequences start here

tell application "Finder" to open chosenfiles
activate application "Adobe Acrobat Professional"
tell application "System Events"
	tell process "Acrobat"
		repeat with i from 1 to (count CropList)
			click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
			select row (i + 13) of outline 1 of scroll area 1 of window "Batch Sequences"
			select static text "Publix 16T Crop " & item i of CropList of row (i + 13) of outline 1 of scroll area 1 of window "Batch Sequences"
			click button "Run Sequence" of window "Batch Sequences"
			click button "OK" of window "Run Sequence Confirmation - Publix 16T Crop " & item i of CropList
			click menu item "Encapsulated PostScript" of menu 1 of menu item "PostScript" of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
			keystroke "g" using {command down, shift down}
			keystroke (OutputFolder)
			keystroke return
			keystroke (item 1 of outfilenames)
			keystroke "." & item i of CropList
			delay 2
			click button "Save" of window "Save As"
			delay 5
			click menu item "Revert" of menu 1 of menu bar item "File" of menu bar 1
			delay 2
			click button "Revert" of front window
			click button "Close" of window "Batch Sequences"
		end repeat
	end tell
end tell


beep 3

-- Returning a list of output file names where the extensions are stripped off
on getoutfilenames(finderitems)
	set outfilenames to {}
	repeat with finderitem in finderitems
		set {name:Nm, name extension:Ex} to info for finderitem
		if Ex is missing value then set Ex to ""
		if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
		set end of outfilenames to Nm
	end repeat
	return outfilenames
end getoutfilenames


Thanks for the help, but that doesn’t work for me. It’s getting stuck in the batch processing window. It looks like i hasn’t been defined yet? Also, I’m not sure if having every file opening at the same time will work well. It will probably bog the computer down and mess up the script. The only reason I only used the first name in the list is because I’m not good with lists yet and thats all I know to do.

I’m satisfied with my script for now, my problem is that I can’t make it an application without getting errors. I’m not using the run command. What else might it be?