Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Paolo F Cantoni on September 08, 2015, 12:51:08 pm

Title: Getting a VBScript to "Sleep"
Post by: Paolo F Cantoni on September 08, 2015, 12:51:08 pm
Anyone know how to get an EA VBScript to sleep?  Typically within a loop.

I'm zipping up an EAP file and I need to wait until the zipping is completed.  I'm NOT a VBScript guru, and research hasn't helped.

TIA,
Paolo
Title: Re: Getting a VBScript to "Sleep"
Post by: Geert Bellekens on September 08, 2015, 04:06:05 pm
Paolo,

Have you tried the suggestions in http://stackoverflow.com/questions/1729075/how-to-set-delay-in-vbscript

Geert
Title: Re: Getting a VBScript to "Sleep"
Post by: Paolo F Cantoni on September 08, 2015, 05:41:14 pm
Quote
Paolo,

Have you tried the suggestions in http://stackoverflow.com/questions/1729075/how-to-set-delay-in-vbscript

Geert
Yes Geert,

That was part of my research.  The WScript object doesn't seem to exist in EA's VBScript as far as I can see - the statement returns an error.  Later in that article it says that WScript is only for Windows Scripting Host.  I was hoping a Sparxian would tell us what the EA equivalent was.

As I said, I'm just a VBScript newbie, although I've been using VBA for decades... :(

Paolo

[edit]BTW: I'm interested in non-CPU hogging mechanisms as I need the Zip to complete - not compete with the wait loop. :)[/edit]
Title: Re: Getting a VBScript to "Sleep"
Post by: Geert Bellekens on September 08, 2015, 06:13:38 pm
Try this:
Code: [Select]
sub main
      dim ws
      Set ws = CreateObject("Wscript.Shell")
      ws.popup "Sleeping for 10 seconds, do not click anything!", 10,"Sleeping", 48
end sub

main
There must be other ways, but this seems pretty user friendly.
If you want to you catch the return of popup to check if the user has clicked OK or not.

Geert
Title: Re: Getting a VBScript to "Sleep"
Post by: Paolo F Cantoni on September 09, 2015, 08:23:46 am
Quote
Try this:
Code: [Select]
sub main
      dim ws
      Set ws = CreateObject("Wscript.Shell")
      ws.popup "Sleeping for 10 seconds, do not click anything!", 10,"Sleeping", 48
end sub

main
There must be other ways, but this seems pretty user friendly.
If you want to you catch the return of popup to check if the user has clicked OK or not.

Geert
Thanks Geert,

I'll give it a go!  It may "kill two birds with one stone"!

Paolo