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

wscript

New Here ,
Dec 08, 2011 Dec 08, 2011

Hi everybody,

I probably have a very simple problem but I can't find any answer over the internet. From what i undersand wscript is a basic object from windows including a lot of script functions like sleep, echo, etc... Why isn't it working when I run my script in Illustrator ?

In most of the samples i read, calling wscript.echo seems to work without any other settings. But when i execute it, i have an "object required : wscript" error, and if i try to create it with "set wscript = createobject("wscript.application")" then I have a "ActiveX component can't cerate object : wscript.application". Any ideas to initialize it and access wscript commands ?

TOPICS
Scripting
1.5K
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
Community Expert ,
Dec 09, 2011 Dec 09, 2011

Illustrator uses its own scripting engine to run vbs scripts, you might not be able to create the wscript object and use its properties and methods.

When you run the script in Windows, the WSH creates the object automatically, so it's always ready to use.

you can however create all other objects that the "Scripting" and "WSH" expose

Set fso = CreateObject("Scripting.FileSystemObject")

Set shellRef = CreateObject("Wscript.Shell")

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
New Here ,
Dec 09, 2011 Dec 09, 2011

Thanks you Carlons for your answer...

I tried this basic script :

Set fso = CreateObject("Scripting.FileSystemObject")

Set shellref = CreateObject("Wscript.Shell")

set app = createobject("Illustrator.application")

set doc = app.activedocument

shellref.echo "hello"

it doesn't work. The shellref object is successfully created, but doesn't have the echo method...

I mainly need to create a menu, use the sleep function, the msgbox... Maybe there is another way to do it in illustrator, but I haven't find 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 ,
Dec 09, 2011 Dec 09, 2011
LATEST

echo is a method of the wscript object, whis is not available to the Illustrator scripting engine,

if you still want to use it, you can...but you can not run your script from Illustrator->File->Scripts, you must double-click the script in an explorer window.

try this, open illustrator, open an AI document, and double click on the script to run

set iapp = CreateObject("Illustrator.Application")

msgbox "hello from Illustrator  - " & iapp.documents.count & " document(s) open"

wscript.echo "hello from wscript " & iapp.activeDocument.name & " - active document's name"

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