|
Welcome to the Web Hosting Forum - Hosting Reviews, Web Hosting Discussion Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content etc. By registering you have access to many other special features, Like personal blogs, your own personal forum, extended profiles, posting of your resume, free links, photo galleries, auctions etc. We are Web 2.0 Compliant . We also reward our posters and referals with free hosting, domains, prizes etc. Even earn points for reading posts. We offer contests, and events that are sure to please anyone in the hosting industry, web developer or SEO at heart. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|
|||||||
| Scripting Working with different windows scripts. |
|
|
LinkBack | Thread Tools |
|
|||
|
Re:WScript.Sleep for HTA?
This is what I use:
' Sleep for HTA by Malcolm McCaffery Sub Sleep(intMilliSecs) CONST HideWindow=0 CONST WaitForCompletion=TRUE ' Because HTA doesn't use Windows Script Host, it uses IE Script Host we can't use WScript.Sleep ' Workaround: send one ping command to fake address with a wait for reply value set in milliseconds cmd="cmd /c ping 1.1.1.1 -n 1 -w " & intMilliSecs With CreateObject("WScript.Shell") .Run cmd,HideWindow,WaitForCompletion End With End Sub |
|
|||
|
Re: Re:WScript.Sleep for HTA?
Malcolm McCaffery wrote:
> This is what I use: > > ' Sleep for HTA by Malcolm McCaffery > Sub Sleep(intMilliSecs) > CONST HideWindow=0 > CONST WaitForCompletion=TRUE > > ' Because HTA doesn't use Windows Script Host, it uses IE Script Host > we can't use WScript.Sleep > ' Workaround: send one ping command to fake address with a wait for > reply value set in milliseconds > cmd="cmd /c ping 1.1.1.1 -n 1 -w " & intMilliSecs > With CreateObject("WScript.Shell") > .Run cmd,HideWindow,WaitForCompletion > End With > End Sub If this is for personal use, you could always install ScriptX (has a Wait method) or AutoItX (has a Sleep method) - both are free. Personally, I'm using the AutoItX v3 COM object... Set aux = CreateObject("AutoItX3.Control") aux.sleep 10000 -- Michael Harris Microsoft.MVP.Scripting |
|
|||
|
Re: WScript.Sleep for HTA?
On Jun 10, 12:13 am, "Michael Harris \(MVP\)" <mikhar.at.mvps.dot.org>
wrote: > Malcolm McCaffery wrote: > > This is what I use: > > > ' Sleep for HTA by Malcolm McCaffery > > Sub Sleep(intMilliSecs) > > CONST HideWindow=0 > > CONST WaitForCompletion=TRUE > > > ' Because HTA doesn't use Windows Script Host, it uses IE Script Host > > we can't use WScript.Sleep > > ' Workaround: send one ping command to fake address with a wait for > > reply value set in milliseconds > > cmd="cmd /c ping 1.1.1.1 -n 1 -w " & intMilliSecs > > With CreateObject("WScript.Shell") > > .Run cmd,HideWindow,WaitForCompletion > > End With > > End Sub > > If this is for personal use, you could always install ScriptX (has a Wait > method) or AutoItX (has a Sleep method) - both are free. > > Personally, I'm using the AutoItX v3 COM object... > > Set aux = CreateObject("AutoItX3.Control") > aux.sleep 10000 > > -- > Michael Harris > Microsoft.MVP.Scripting- Hide quoted text - > > - Show quoted text - There is another workaround that you may find interesting, using the setTimeOut function of the DOM Function Blahblah ...... IntervalMarker = setTimeout("CarryOn", 50, "vbscript") End Function ' ' ===== carries on from above when interval expires ' this "feature" allows the updated status message to be ' rendered and viewed by the user ' Function CarryOn ' Code to be executed after the delay .... more of this function End Function |
|
|||
|
Re: WScript.Sleep for HTA?
THis is a script that works in an HTA script. You end up calling the CCsleep
sub 'set i for 6 seconds then call sub Counter1(i) which calls ccsleep i = 6 Call Counter1(i) Sub Counter1(i) While i <> 0 i=i-1 DataArea.InnerHTML = "Ready to open txt file in <b>" & i & "</b> seconds." t0 = Timer ccSleep 1 Wend 'Call getMachineType 'MsgBox timer - t0 window.close End Sub '_________________________________________________ _________________________________________________ Sub ccSleep(seconds) Set oShell = CreateObject("Wscript.Shell") cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul" oShell.Run cmd,0,1 End Sub "rickety" wrote: > On Jun 10, 12:13 am, "Michael Harris \(MVP\)" <mikhar.at.mvps.dot.org> > wrote: > > Malcolm McCaffery wrote: > > > This is what I use: > > > > > ' Sleep for HTA by Malcolm McCaffery > > > Sub Sleep(intMilliSecs) > > > CONST HideWindow=0 > > > CONST WaitForCompletion=TRUE > > > > > ' Because HTA doesn't use Windows Script Host, it uses IE Script Host > > > we can't use WScript.Sleep > > > ' Workaround: send one ping command to fake address with a wait for > > > reply value set in milliseconds > > > cmd="cmd /c ping 1.1.1.1 -n 1 -w " & intMilliSecs > > > With CreateObject("WScript.Shell") > > > .Run cmd,HideWindow,WaitForCompletion > > > End With > > > End Sub > > > > If this is for personal use, you could always install ScriptX (has a Wait > > method) or AutoItX (has a Sleep method) - both are free. > > > > Personally, I'm using the AutoItX v3 COM object... > > > > Set aux = CreateObject("AutoItX3.Control") > > aux.sleep 10000 > > > > -- > > Michael Harris > > Microsoft.MVP.Scripting- Hide quoted text - > > > > - Show quoted text - > > There is another workaround that you may find interesting, using the > setTimeOut function of the DOM > > Function Blahblah > ...... > IntervalMarker = setTimeout("CarryOn", 50, "vbscript") > End Function > ' > ' ===== carries on from above when interval expires > ' this "feature" allows the updated status message to be > ' rendered and viewed by the user > ' > Function CarryOn ' Code to be executed after the > delay > .... more of this function > End Function > > |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
All times are GMT -5. The time now is 01:23 AM.