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

Adobe Illustrator got an error: JavaScript code was missing

Community Beginner ,
Nov 25, 2019 Nov 25, 2019

So basically I have an apple script which creates folders and opens an Illustrator document and then calls a Javascript to run which outlines all the fonts and creates 2 PDFs. This script was working fine in all previous versions of Illustrator.

The issue is when I get to this part of the script

set scripttoRun to "Sim 07:Applications:Adobe:Outline10mmHRLRPDF.jsx" as alias
	tell application "Adobe Illustrator"
		activate
		open theFile
		do javascript scripttoRun

I get an error:

On

do javascript scripttoRun

Adobe Illustrator got an error: JavaScript code was missing

 

I have tried changing the location of the Javascript but this does not seem to work. 

Any ideas?

Thanks

 

TOPICS
Scripting
1.2K
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
Adobe
Valorous Hero ,
Nov 27, 2019 Nov 27, 2019

I had the same issue when trying to run my extendscript in Illustrator from a JXA script. It seems as if this is an Ai 2020 issue, perhaps. Well, the way I fixed it was still doing a do javascript command but I made sure my javascript was not called from a 'file' but rather an evaluated file-path at script 'compilation' time (?).
set myScript to "eval('#include /Users/Me/MyFolder/MyScript.jsx')"
do javascript myScript

 

Try this and see if it works. If it does and in the previous versions you used to not have to do that, please comment on here to vote for whether this is an issue related to Ai 2020 version.

 

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 Beginner ,
Nov 27, 2019 Nov 27, 2019

Thanks Silly-V,

Unfortunatly I couldn't get your script amend to work. I must confess I know little about scripting. I pasted this together from script examples I found. I have copied my entire Apple Script into this post. Is it possible for you to amend and I can test. Sorry to be so lame.

Thanks

 

tell application "Finder"
	set theLocation to (target of front window)
	tell theLocation
		if not (exists folder "Art") then make new folder at it with properties {name:"Art"}
		if not (exists folder "PDF") then make new folder at it with properties {name:"PDF"}
		if (exists file "Delete me") then delete file "Delete me"
		try
			move (1st file whose name extension is "indd") to folder "Art" with replacing
		end try
		try
			move (1st file whose name extension is "ai") to folder "Art" with replacing
		end try
		
	end tell
end tell



set inputFolder to choose folder with prompt "Select Illustrator Document." without invisibles
--

tell application "Finder"
	set filesList to (files in inputFolder whose name extension is "ai")
end tell
--
repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
		set theFileName to name of theFile
	end tell
	
	
	set scripttoRun to "Sim 07:Applications:Adobe:Outline5mmHRLRPDF.jsx" as alias
	tell application "Adobe Illustrator"
		activate
		open theFile
		do javascript scripttoRun
		
		
	end tell
end repeat
--

tell application "Finder"
	set theLocation to (target of front window)
	tell theLocation
		try
			move (files whose name extension is "pdf") to folder "PDF" with replacing
		end try
		try
			move (files whose name extension is "ai") to folder "Art" with replacing
		end try
	end tell
end tell

 

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
Valorous Hero ,
Nov 29, 2019 Nov 29, 2019

Well you just change your line

set scripttoRun to "Sim 07:Applications:Adobe:Outline5mmHRLRPDF.jsx"

to be set scripttoRun to "eval('#include \'Sim 07/Applications/Adobe/Outline5mmHRLRPDF.jsx\')"

 

-- My syntax may be wrong, but that's the general idea , does this help in any way?

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 Beginner ,
Dec 02, 2019 Dec 02, 2019
LATEST

Thanks Silly-V,

 

I couldn't get your script to work unfortunatly, but I figured out a fix.

Changed:

set scripttoRun to "Sim 07:Applications:Adobe:Outline5mmHRLRPDF.jsx" as alias
	tell application "Adobe Illustrator"
		activate
		open theFile
		do javascript scripttoRun

to:

tell application "Adobe Illustrator"
		activate
		open theFile
		tell application "Adobe Illustrator" to open file "Sim 07:Applications:Adobe:Outline5mmHRLRPDF.jsx"

Super simple but seems to work for me. Thanks for all your help.

Cheers

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