Web Hosting Forum - Hosting Reviews, Web Hosting Discussion ForumCalendarContact Us

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.

Go Back   Web Hosting Forum - Hosting Reviews, Web Hosting Discussion Forum > The Operating Systems > Windows Issues > Scripting

Scripting Working with different windows scripts.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-10-2007, 03:26 AM
Malcolm McCaffery
 
Posts: n/a
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
Reply With Quote
  #2 (permalink)  
Old 06-10-2007, 03:26 AM
Michael Harris \(MVP\)
 
Posts: n/a
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


Reply With Quote
  #3 (permalink)  
Old 06-12-2007, 06:21 AM
rickety
 
Posts: n/a
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

Reply With Quote
  #4 (permalink)  
Old 06-15-2007, 05:32 AM
Digiman57
 
Posts: n/a
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
>
>

Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View:
Points Per Thread:
Points Per Reply:


All times are GMT -5. The time now is 01:23 AM.


International Visitors Translate Hostingforum.ca here

Dedicated Hosting


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 Copyright 2008 Net Industries, LLC.