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

apple script execute via do script (using javascript).

Advocate ,
May 13, 2013 May 13, 2013

Hi Scripters,

Can you any one please look into this and solve my problem.

My request I want to delete the unused swatches in Illustrator, So that I used the apple script its working fine, the same code i want to execute via do script (java Script).

The below Lines I used the Apple script its working fine in the MAC.

After I save as the script file, and app file. I want to execute this from Illustrator using java script but its not working.

----------------------

tell application "Adobe Illustrator"

   activate

   tell current document

     do script "Delete Unused Panel Items" from "Default Actions" without dialogs

   end tell

  end tell

--------------------

var mege_excel = File(getScriptPath().parent+ "/ILLUS.scpt");

app.doScript(mege_excel, ScriptLanguage.applescriptLanguage);

function getScriptPath() {

  try {

        return app.activeScript;

        }catch(e) {

            return File(e.fileName);

            }

        }

thx,

csm_phil

TOPICS
Scripting
4.1K
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
Participant ,
May 13, 2013 May 13, 2013

Hi csm_phil

have a look into previous discusstions regarding this issue!

http://forums.adobe.com/thread/623537

http://forums.adobe.com/message/4089876

i hope this helps

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
Guru ,
May 13, 2013 May 13, 2013

AI has no app.doScript() method thats an ID thing… If you are scripting CS6 then you call just call the action its a new scripting feature… If you need to execute a complied script then try the File Object execute() method…

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
Advocate ,
May 13, 2013 May 13, 2013

Hi tech_panda and mark,

Can you please give me the sample how to process my request. I am using Illustrator CS5 Windows 7.

thx,

csm_phil

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
Guru ,
May 13, 2013 May 13, 2013

Not even windows 8 can do AppleScript… CS5 has no method to run an action this has been on everyones wish list for years and they only just added it… Probably vanish with the cloud too… pop()

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
Advocate ,
May 13, 2013 May 13, 2013

Hi Mark,

any other options to acheive this.

thx,

csm_phil

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
Guru ,
May 13, 2013 May 13, 2013

Not with any great ease… I recall John Wundes had a remove fluff some time back… You might try that…

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 ,
May 13, 2013 May 13, 2013

After a little testing, it seems that the Default Actions don't work too well in CS6. I tried the Delete Unused Panel Items from the Default set and it won't go beyond the first part which is selecting and deleting the unused Symbols. Yet another reason to stick with CS5.

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
Guru ,
May 13, 2013 May 13, 2013

Well don't that sound typical… Add scriptability n break a working app feature…

Don't tell the general forum they will come n blame us…

I always found the action needed running twice in CS2 with AppleScript or the GUI.

In CS5 it don't remove all the unused no matter how many times I run it…?

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 ,
May 13, 2013 May 13, 2013

It's always worked for me. I even have the action assigned to an F-key.

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
Advocate ,
May 13, 2013 May 13, 2013

Dear Mark & Larry,

In forum participant are not blamed to adobe developers, we need a solution thats all. Any way there no possibilties to achieve this fine, Atleat Illustrator forthcoming version to achieve this requirement via javascript. please notice to adobe this will take care updated version release!

Don't tell the general forum they will come n blame us…

I always found the action needed running twice in CS2 with AppleScript or the GUI.

In CS5 it don't remove all the unused no matter how many times I run it…?

Finally I ask one more thing, I want to execute the action, that is I alread created the action to delete the swatches in Illustrator I used the short cut key is F2, How I can call the action in javascript. Please advice.

thx,

csm_phil.

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 ,
May 13, 2013 May 13, 2013

you were given the answer already, with CS5 and earlier you can only run actions via AppleScript (mac) and vbscript (windows)...Javascript does not support running actions.

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 ,
May 13, 2013 May 13, 2013
LATEST

In CS5, you can only use AppleScript or Visual Basic to run an action. The ability to do this in ExtendScript is new to CS6 and above. The only other way would be to use system events to press the F-key but I have no real experience with this.

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 ,
May 13, 2013 May 13, 2013

it's possible using vbs, if you don't mind using it.

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