6 Replies Latest reply on Sep 12, 2018 7:11 AM by kendall_hiles

    equivalent to "WScript.ScriptFullName"?


      Because in Mentor Automation "WScript" is an unknown object, so I'm not not be able to figure out the Scripts-Directory!

      Is there a way to become that information within Mentor Automation Scripting?


      I need it, because I will save in the Scripts Directory additional files, that I need inside my scripting.

      And I favor to be dynamically and won't save static path.

        • 1. Re: equivalent to "WScript.ScriptFullName"?

          I understand the question but don't have an answer yet.  How are you invoking the script?  I ask because it might be possible to pass the script location as a argument to the script...?

          • 2. Re: equivalent to "WScript.ScriptFullName"?

            Unfortunately, the answer is both yes and no, depending upon the application.  In xPCB Automation documentation, the source folder for a running script can be determined from ScriptHelper.Arguments(2).  But, xDX Automation does not have access to ScriptHelper.


            I filed this issue as a service request in May 2017 (SR #2962701072: How can a running script find its source folder?), which was quickly closed with the standard statement to submit this item as an enhancement request on the Ideas site. (IOW: Go pound sand).

            • 3. Re: equivalent to "WScript.ScriptFullName"?

              Did you file an Idea? If so, please post the link here so that more people can vote for it.

              • 4. Re: equivalent to "WScript.ScriptFullName"?

                If mgcscript is used to invoke the script then ScriptHelper.Arguments CAN be used to obtain script's complete full name for DxDesigner as well.  Here's an example:


                Dim ScriptArgs
                Set ScriptArgs = ScriptHelper.Arguments

                 arg1, sScriptName

                arg1 = ScriptArgs.Item(1)
                sScriptName = ScriptArgs.item(2)

                MsgBox"arg1 is " & arg1
                MsgBox"Script name is " & sScriptName

                • 5. Re: equivalent to "WScript.ScriptFullName"?

                  Thanks for answers. I don't like the option to pass a parameter for that (I don't need just the one or another value).


                  I will load some shared script or own include-files and to make a kind of things editable for me and admins. sometimes also just a .cfg in format of VBScript (Const etc.) So I load some own include scripts, like Classes/Basefuncs etc...


                  Set hwnd = fso.OpenTextFile("<path of scriptform>\include.vbs",1,False)
                  ExecuteGlobal hwnd.ReadAll()                      ' -- Include Class script
                  Set hwnd = Nothing


                  The big advantage is, that I can store some controlled code out of a .efm formular. Unique Basefunctions maybe, that use different .efm's or anything else. When I read right, there is no way to currently find out the scripts-path? it's a pity


                  Okay my solution now is... to store my include-scripts in a fixed path and create a Systemvariable (Environment) for that path...

                  Set WshShell = CreateObject("Wscript.Shell")


                  • 6. Re: equivalent to "WScript.ScriptFullName"?

                    AATK, XPKGUTILS, vendor specific toolkits, and my customers all set an environment variable to specify the root of their scripting directory.  That way one script can call another, get icons...