Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Illustrator batch messing up simple script

Explorer ,
Feb 14, 2011 Feb 14, 2011

I have a script that checks a folder of Illustrator files for multiline text that are in separate frames rather than one single multiline frame.  It logs the drawing name to an excel file and saves it out.

Then I have another script that deletes that file with fso object and creates a new one pulling down all the textFrame contents to it's corresponding cell.  These scripts need to be batched, so obviously it checks to see if the files exists, then if not, creates it, if so, creates new entry in that file and saves it.  Single file use these scripts work fantastic.  However, when I batch the last script, it gives me an error saying FixMeList.xls is of unknown file format and the script quits.  When I try running it on a single file, everything works.

The only code it's trying to execute at the moment is checking to see if the file exists, if so, delete it.

As I said, the code works fine if I have a doc open and run it on that doc.  It doesn't if I batch run it on a folder.

Here is the snippet of that part of code that's not working in batch.

'Create object

Set objIllustrator = CreateObject("Illustrator.Application")
Set docIllustrator = objIllustrator.ActiveDocument
Set objExcel = CreateObject("Excel.application")
'Disable all excel warnings about overwriting or saving
objExcel.DisplayAlerts = False
objExcel.AskToUpdateLinks = False
objExcel.AlertBeforeOverwriting = False
'Variables
Dim fso
Dim srcTextFrame
Dim startRow
Dim folPath
Dim xlationBook

Dim msgAlert


'Assigning a variable to hold the path of the current drawing batch folder
folPath = docIllustrator.Path
dwgName = docIllustrator.Name
xlationBook = folPath & "FixMeList.xls"

'Create the file system object for checking file existence
Set fso = CreateObject("Scripting.FileSystemObject")
'make sure that the multilines have all been fixed 
If fso.FileExists(folPath & "FixMeList.xls") Then
fso.DeleteFile(folPath & "FixMeList.xls")           
Set fso = Nothing
End If

Edited to post code snippet

TOPICS
Scripting
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 14, 2011 Feb 14, 2011

ok, I got the same error message, the problem is that running in batch Illustrator needs to open the file (all the files) first before running the script. So, the error is telling you "I don't know how to open Excel files".

the batch folder needs to have files Illustrator knows how to open, move the Excel file that need to be deleted to a different folder and it will run ok.

Translate
Adobe
Explorer ,
Feb 14, 2011 Feb 14, 2011

VBscript, by the way, if it matters.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2011 Feb 14, 2011

Hi,

is it 2 scripts or 1?

how do you batch run the script in a folder?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 14, 2011 Feb 14, 2011

There is one script that checks all the ai files in a folder for text that

is too close together, meaning it may need to be one textbox for translation

purposes. It creates an excel document and any ai file that meets that

condition gets recorded into a cell.

The next script looks to make sure that excel sheet is present so that it

knows you fixed the files before trying to get the textframe contents. It

then deletes that file and creates a new one to pull all the text from each

textframe to a cell in the new excel spreadsheet. This is a form of error

trapping to make sure nothing gets skipped.

I run these scripts through Illustrators Actions Panel, I load the script

in, then batch a folder through that panel. But for some reason it throws

an error when trying to delete the first .xls, saying it's an unkown file

format and could not open.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 14, 2011 Feb 14, 2011

So only one script that seems to be causing me a problem, I suppose I could do the loading of the files via the script.  Maybe ask the user for the folder name and then count through each.ai in the folder and check it rather than loading the folder contents via Illustrator batch.  I just don't know how to do that.  I've been pondering all day trying to think of ways to just have the script do everything.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2011 Feb 14, 2011

ok, I got the same error message, the problem is that running in batch Illustrator needs to open the file (all the files) first before running the script. So, the error is telling you "I don't know how to open Excel files".

the batch folder needs to have files Illustrator knows how to open, move the Excel file that need to be deleted to a different folder and it will run ok.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2011 Feb 15, 2011
LATEST

Thanks again for your time, Carlos!  Great help!  I can't believe it was something so simple that didn't cross my mind...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines