The only way that I know, and that we use is to create a scripts.ini in the
project directory that has an entry with the script you want to execute.
Something like this:
The script of course needs to be present somewhere in your WDIR path
Your method will start a script but it will be executed under DxD, not Windows shell.
did you use getObject() or createObject() in mgcscript?
This snippet does start DxD and opens a project:
dim vdapp, myproject
myproject = "C:\MentorGraphics\1_local_designs\mini\mini.prj"
Set vdapp = CreateObject("ViewDraw.Application")
msgbox "project opened: " + myproject
vdapp.Visible = True
But please note that I always get strange behaviour of Get/Create Object for "ViewDraw.Application"!
This one did connect to a running DxD instead of creating a new instance of DxD!
Also I failed to use getObject(,"ViewDraw.Application") to loop through multiple running DxD sessions!
I suggest you to create new C# project (M$ Visual Studio) and translate your script to C#.
Remember to add reference to Viewdraw 1.0. The you will have much more possibility to debug your code.
VBS/JS code is hard to write and debug. In my opinion these two languages are pourly documented.
For example I was not able to configure Eclipse to work with VBS/JS DxD scripts...
Let me clarifiy something.
I'm looking for method of starting ANY script from WDIR directory directly from Windows shell. (without any modification of original code)
I need this metohod to configure my Eclipse envirnoment.
5 days and no answer?
Does it mean that it is not possible?
I use usually icscript.exe or mgcscript.exe to run DxDesigner .vbs scripts from CMD window in Windows.
mgcscript and cscript are VBS/JS interpreters but how you deal with reference to ViewDraw?
I spent few hours trying to execute VBS code (that is working from DxD command line) with mgcscript. Here is what I always see:
Source:'Microsoft VBScript runtime error'
Error:0x800a01a8 'Object required: 'Wscript''
Here are 3 first lines of my code:
3. Set objWMIService = Wscript.GetObject("Viewdraw.Application")
pozdrowienia dla Katowic :-)
please try this and take care of the ',' in GetObject(,"
Set objApplication = GetObject(,"Viewdraw.Application")
msgbox "deign=" & objApplication.GetActiveDesign()
This does work with mgcscript if DxD is running.
Mit freundlichen Grüßen
Thank you Frank, it works!
Another method. You can make a vb script file. Call it anything you want, put it anywhere. For example:
Inside the file, paste the following:
'msgbox("in the script")
set wsh = CreateObject("shell.application")
'you can put almost anything in the following line - file, executable, directory path, whatever.
'it will run with the system default software for the file type, or just run the executable.
path = "C:\Program Files\iTunes\iTunes.exe"
set wsh = Nothing
Modify the line with the path in it to start whatever script, executable, file, or whatever you want. Then you can run it from the "Run" command, or a console window.
Not sure if this is what you are getting to, but it will run whatever you want, with surrounding prompts, messages, or whatever else you want to put in there.