Author Topic: Getting a VBScript to "Sleep"  (Read 8402 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Getting a VBScript to "Sleep"
« 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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting a VBScript to "Sleep"
« Reply #1 on: September 08, 2015, 04:06:05 pm »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Getting a VBScript to "Sleep"
« Reply #2 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]
« Last Edit: September 08, 2015, 05:46:53 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting a VBScript to "Sleep"
« Reply #3 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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Getting a VBScript to "Sleep"
« Reply #4 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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!