Jump to content
Macro Express Forums

Wsh Vbscript Recommendations


Recommended Posts

Hello Robert-HK!


There are examples of controlling VBScript using Macro Express in the Third-Party forum. Here is a link to one that sorts strings. There are also examples of running HTAs from Macro Express.


Many VBScript files can be run at the same time, and all can be launched from within Macro Express. The trick is to get Macro Express to pause until the script finishes. One way is to have your VBScript file write a dummy file when it ends, and have Macro Express wait until it sees the file before continuing.


Cscript is generally used for debugging and wscript is run by default when clicking on a .vbs or .wsh file.

Link to comment
Share on other sites



Thanks for that example. I noticed when running it that I got a warning from Norton as shown in the attached image.


With ME I can check for this and allow processing to proceed but is there a simpler way, apart from turning off Norton?


To handle exceptions and observe progress of the script, it seems that wscript.echo would provide a series of windows which could be checked for by ME. Do you see any problems with this approach?




Link to comment
Share on other sites

We do not use Norton so I cannot give any advice on it. Maybe there is a way to set Norton so that files within a particular folder can be run without exception. If so, then you need only change the output folder within the macro. Others in this forum that use Norton, or maybe even the Norton forum itself, might have solutions.


I'm not sure how well the wscript.echo command would work in this situation because it requires you to click the "OK" button when it, er, echoes something.


Most of the scripts we create for clients do not require user interaction. They are just fired up to do a task and then stop. Returning results to Macro Express is done through files, the Registry, or having the script generate a "runnable" macro command.


When interaction is required, we generally use an HTA, which I am sure is something else that your Norton will feel itchy about. There are some examples of this in the Third Party Tools forum.


All that being said, I am willing to bet there are more "elegant" ways to handle interaction between Macro Express and the Windows Script Host, but we have not yet investigated them.

Link to comment
Share on other sites



Thanks for the advice. I'm still finding my way in the world of scripting and intending to use ME as a kind of "wrapper" for the various useful scripts and utilities I find. For example, I sometimes need to convert some JPEGs into PDFs, add a document control sheet and have a single PDF as output with the control sheet (originally Excel) as the first sheet.


To do this, I print the Excel to a pdf using a pdf printer. I use ImageMagick via the command prompt to convert and combine the JPEGs with tight control over compression, resolution and so on. I then use the pdftk toolkit via the command line to combine the various pdfs as I want them. (see http://www.imagemagick.org/script/index.php and http://www.accesspdf.com/pdftk/ ) ME seems the best way to tie all this together with consistent naming conventions and directory structures. The HTA approach you cited looks like a good candidate for "wrapping" imagemagick since I never use any of these command line tools often enough to remember usage parameters. Time for me to study your examples further.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...