Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Thu, 23 Mar 2006 18:12:10 -0500,    group: microsoft.public.inetsdk.programming.scripting.vbscript        back       


How can I use wscript.sleep from Internet Explorer menu script?   
Hello,

I have a VB script which is called by internet explorer in response to a 
context menu selection.  I used the techinques in this article:

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp

In my script, I can do lots of things but unlike VB scripts run from the 
command line I can't do things like "wscript sleep 1000".  If I try I get 
"Error: Object required: 'WScript'".

So how can I use wscript features from an Internet Explorer VB script?

Thanks!

Grant Schenck
date: Thu, 23 Mar 2006 18:12:10 -0500   author:   Grant Schenck

Re: How can I use wscript.sleep from Internet Explorer menu script?   
If you're running a client-side VB script within the browser, the WSH
objects aren't available because you're not using the WSH to execute
the code.  Although I could be wrong, I am not aware of any object
available to VBS within the browser that allows for the non-processor
intensive sleep function.
date: Thu, 23 Mar 2006 17:06:55 -0800   author:   JTW

RE: How can I use wscript.sleep from Internet Explorer menu script?   
I use the timer for this.

you'll have to cut the process in two (or more if you want to use the sleep 
more often.  
Or alternatively make your function state driven, which so that it can be be 
called multiple times and depending on a global state will process a 
different section of your code.  
Below is an example of how I do it, All you need to do is replace 
YourFunction in the function ItsTime and from your code you call 
StartProcess(Yourfunction) and 

(I have clipped it out of existing code, I think it will function as is, but 
maybe overlooked something.


dim gStatusTimer
Function StartStatusTimer
   if gStatusTimer = 0 Then
      gStatusTimer = window.setInterval("ItsTime()", 1000)
   End If
End Function

Function StopStatusTimer
   if gStatusTimer <> 0 Then
      window.clearInterval gStatusTimer
      gStatusTimer = 0
   end If
End Function

Dim gProcessName
Sub StartProcess(sProcessName)
   gProcessName = sProcessName
End Sub

Function AtLeastOneMachineInstalling
   AtLeastOneMachineInstalling = True
End Function

Function ItsTime
   'Stop the timer to avoid a timer event during a lengthy process.
   StopStatusTimer

   If Len(gProcessName) > 0 Then
      sTemp = gProcessName
      gProcessName = ""

      Select Case sTemp
      Case "YourFunction"
         YourFunction
      Case Else
         Msgbox "Programming error: process called: " & sTemp
      End Select
   End If

   StartStatusTimer
End Function


"Grant Schenck" wrote:

> Hello,
> 
> I have a VB script which is called by internet explorer in response to a 
> context menu selection.  I used the techinques in this article:
> 
> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
> 
> In my script, I can do lots of things but unlike VB scripts run from the 
> command line I can't do things like "wscript sleep 1000".  If I try I get 
> "Error: Object required: 'WScript'".
> 
> So how can I use wscript features from an Internet Explorer VB script?
> 
> Thanks!
> 
> Grant Schenck 
> 
> 
> .
>
date: Sun, 26 Mar 2006 15:06:33 -0800   author:   wimZ

Re: How can I use wscript.sleep from Internet Explorer menu script?   
This looks like a possible solution, I'm not familiar with using timers from 
VB script.

Based on the code below, I'm not clear what the script is doing while this 
periodic timer events happen?

For example, presumably after I kick off some activity which I want to check 
up on later I call your StartStatusTimer function.  Then what do I do?  What 
does the script wait on so that the timer interval task can get control?

By the way, the COM object I'm interfacing with generates an event.  Can 
somehow handle that directly from VB script and if so, again, what does is 
my script doing when it is in the mode waiting for events?

Thanks!
-- 
Grant Schenck
http://grantschenck.tripod.com

"wimZ"  wrote in message 
news:1249C51B-CDDE-4110-8A13-35EF3B97E980@microsoft.com...
>I use the timer for this.
>
> you'll have to cut the process in two (or more if you want to use the 
> sleep
> more often.
> Or alternatively make your function state driven, which so that it can be 
> be
> called multiple times and depending on a global state will process a
> different section of your code.
> Below is an example of how I do it, All you need to do is replace
> YourFunction in the function ItsTime and from your code you call
> StartProcess(Yourfunction) and
>
> (I have clipped it out of existing code, I think it will function as is, 
> but
> maybe overlooked something.
>
>
> dim gStatusTimer
> Function StartStatusTimer
>   if gStatusTimer = 0 Then
>      gStatusTimer = window.setInterval("ItsTime()", 1000)
>   End If
> End Function
>
> Function StopStatusTimer
>   if gStatusTimer <> 0 Then
>      window.clearInterval gStatusTimer>      gStatusTimer = 0
>   end If
> End Function
>
> Dim gProcessName
> Sub StartProcess(sProcessName)
>   gProcessName = sProcessName
> End Sub
>
> Function AtLeastOneMachineInstalling
>   AtLeastOneMachineInstalling = True
> End Function
>
> Function ItsTime
>   'Stop the timer to avoid a timer event during a lengthy process.
>   StopStatusTimer
>
>   If Len(gProcessName) > 0 Then
>      sTemp = gProcessName
>      gProcessName = ""
>
>      Select Case sTemp
>      Case "YourFunction"
>         YourFunction
>      Case Else
>         Msgbox "Programming error: process called: " & sTemp
>      End Select
>   End If
>
>   StartStatusTimer
> End Function
>
>
> "Grant Schenck" wrote:
>
>> Hello,
>>
>> I have a VB script which is called by internet explorer in response to a
>> context menu selection.  I used the techinques in this article:
>>
>> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
>>
>> In my script, I can do lots of things but unlike VB scripts run from the
>> command line I can't do things like "wscript sleep 1000".  If I try I get
>> "Error: Object required: 'WScript'".
>>
>> So how can I use wscript features from an Internet Explorer VB script?
>>
>> Thanks!
>>
>> Grant Schenck
>>
>>
>> .
>>
date: Mon, 27 Mar 2006 10:48:18 -0500   author:   Grant Schenck

Re: How can I use wscript.sleep from Internet Explorer menu script   
In 6.0 you can simulate a sleep with javascript: 
function pause(numberMillis) { 
var dialogScript = 'window.setTimeout(' + ' function () { window.close(); 
}, ' + numberMillis + ');'; 
getWindow().showModalDialog('javascript:document.writeln(' + '"<script>' + 
dialogScript + '<' + '/script>")'); 
} 

this is the only real working sleep function.

The 'simulation' with timer functions is not a real sleep at all. 
(Unfortunately.)

Well, in IE7.0, the sleep function doesn't work anymore. So maybe you 
shouldn't use it. I use it and probably a have to do a total rebuild of my 
application when IE7.0 has no sleep functionality anymore.

(I wonder why in al those years no standard sleep function is built in IE 
(and FireFox),
with all the asynchronous XML requests and form post we lack a sleep 
function.)




"Grant Schenck" wrote:

> This looks like a possible solution, I'm not familiar with using timers from 
> VB script.
> 
> Based on the code below, I'm not clear what the script is doing while this 
> periodic timer events happen?
> 
> For example, presumably after I kick off some activity which I want to check 
> up on later I call your StartStatusTimer function.  Then what do I do?  What 
> does the script wait on so that the timer interval task can get control?
> 
> By the way, the COM object I'm interfacing with generates an event.  Can 
> somehow handle that directly from VB script and if so, again, what does is 
> my script doing when it is in the mode waiting for events?
> 
> Thanks!
> -- 
> Grant Schenck
> http://grantschenck.tripod.com
> 
> "wimZ"  wrote in message 
> news:1249C51B-CDDE-4110-8A13-35EF3B97E980@microsoft.com...
> >I use the timer for this.
> >
> > you'll have to cut the process in two (or more if you want to use the 
> > sleep
> > more often.
> > Or alternatively make your function state driven, which so that it can be 
> > be
> > called multiple times and depending on a global state will process a
> > different section of your code.
> > Below is an example of how I do it, All you need to do is replace
> > YourFunction in the function ItsTime and from your code you call
> > StartProcess(Yourfunction) and
> >
> > (I have clipped it out of existing code, I think it will function as is, 
> > but
> > maybe overlooked something.
> >
> >
> > dim gStatusTimer
> > Function StartStatusTimer
> >   if gStatusTimer = 0 Then
> >      gStatusTimer = window.setInterval("ItsTime()", 1000)
> >   End If
> > End Function
> >
> > Function StopStatusTimer
> >   if gStatusTimer <> 0 Then
> >      window.clearInterval gStatusTimer>      gStatusTimer = 0
> >   end If
> > End Function
> >
> > Dim gProcessName
> > Sub StartProcess(sProcessName)
> >   gProcessName = sProcessName
> > End Sub
> >
> > Function AtLeastOneMachineInstalling
> >   AtLeastOneMachineInstalling = True
> > End Function
> >
> > Function ItsTime
> >   'Stop the timer to avoid a timer event during a lengthy process.
> >   StopStatusTimer
> >
> >   If Len(gProcessName) > 0 Then
> >      sTemp = gProcessName
> >      gProcessName = ""
> >
> >      Select Case sTemp
> >      Case "YourFunction"
> >         YourFunction
> >      Case Else
> >         Msgbox "Programming error: process called: " & sTemp
> >      End Select
> >   End If
> >
> >   StartStatusTimer
> > End Function
> >
> >
> > "Grant Schenck" wrote:
> >
> >> Hello,
> >>
> >> I have a VB script which is called by internet explorer in response to a
> >> context menu selection.  I used the techinques in this article:
> >>
> >> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
> >>
> >> In my script, I can do lots of things but unlike VB scripts run from the
> >> command line I can't do things like "wscript sleep 1000".  If I try I get
> >> "Error: Object required: 'WScript'".
> >>
> >> So how can I use wscript features from an Internet Explorer VB script?
> >>
> >> Thanks!
> >>
> >> Grant Schenck
> >>
> >>
> >> .
> >> 
> 
> 
>
date: Tue, 28 Mar 2006 07:19:02 -0800   author:   Robin P

Re: How can I use wscript.sleep from Internet Explorer menu script   
Any idea of how I'd do this from a VB Script?
-- 
Grant Schenck

"Robin P"  wrote in message 
news:26066040-0A27-4C7E-BAE3-924F35600395@microsoft.com...
>
> In 6.0 you can simulate a sleep with javascript:
> function pause(numberMillis) {
> var dialogScript = 'window.setTimeout(' + ' function () { window.close();
> }, ' + numberMillis + ');';
> getWindow().showModalDialog('javascript:document.writeln(' + '"<script>' +
> dialogScript + '<' + '/script>")');
> }
>
> this is the only real working sleep function.
>
> The 'simulation' with timer functions is not a real sleep at all.
> (Unfortunately.)
>
> Well, in IE7.0, the sleep function doesn't work anymore. So maybe you
> shouldn't use it. I use it and probably a have to do a total rebuild of my
> application when IE7.0 has no sleep functionality anymore.
>
> (I wonder why in al those years no standard sleep function is built in IE
> (and FireFox),
> with all the asynchronous XML requests and form post we lack a sleep
> function.)
>
>
>
>
> "Grant Schenck" wrote:
>
>> This looks like a possible solution, I'm not familiar with using timers 
>> from
>> VB script.
>>
>> Based on the code below, I'm not clear what the script is doing while 
>> this
>> periodic timer events happen?
>>
>> For example, presumably after I kick off some activity which I want to 
>> check
>> up on later I call your StartStatusTimer function.  Then what do I do? 
>> What
>> does the script wait on so that the timer interval task can get control?
>>
>> By the way, the COM object I'm interfacing with generates an event.  Can
>> somehow handle that directly from VB script and if so, again, what does 
>> is
>> my script doing when it is in the mode waiting for events?
>>
>> Thanks!
>> -- 
>> Grant Schenck
>> http://grantschenck.tripod.com
>>
>> "wimZ"  wrote in message
>> news:1249C51B-CDDE-4110-8A13-35EF3B97E980@microsoft.com...
>> >I use the timer for this.
>> >
>> > you'll have to cut the process in two (or more if you want to use the
>> > sleep
>> > more often.
>> > Or alternatively make your function state driven, which so that it can 
>> > be
>> > be
>> > called multiple times and depending on a global state will process a
>> > different section of your code.
>> > Below is an example of how I do it, All you need to do is replace
>> > YourFunction in the function ItsTime and from your code you call
>> > StartProcess(Yourfunction) and
>> >
>> > (I have clipped it out of existing code, I think it will function as 
>> > is,
>> > but
>> > maybe overlooked something.
>> >
>> >
>> > dim gStatusTimer
>> > Function StartStatusTimer
>> >   if gStatusTimer = 0 Then
>> >      gStatusTimer = window.setInterval("ItsTime()", 1000)
>> >   End If
>> > End Function
>> >
>> > Function StopStatusTimer
>> >   if gStatusTimer <> 0 Then
>> >      window.clearInterval gStatusTimer>      gStatusTimer = 0
>> >   end If
>> > End Function
>> >
>> > Dim gProcessName
>> > Sub StartProcess(sProcessName)
>> >   gProcessName = sProcessName
>> > End Sub
>> >
>> > Function AtLeastOneMachineInstalling
>> >   AtLeastOneMachineInstalling = True
>> > End Function
>> >
>> > Function ItsTime
>> >   'Stop the timer to avoid a timer event during a lengthy process.
>> >   StopStatusTimer
>> >
>> >   If Len(gProcessName) > 0 Then
>> >      sTemp = gProcessName
>> >      gProcessName = ""
>> >
>> >      Select Case sTemp
>> >      Case "YourFunction"
>> >         YourFunction
>> >      Case Else
>> >         Msgbox "Programming error: process called: " & sTemp
>> >      End Select
>> >   End If
>> >
>> >   StartStatusTimer
>> > End Function
>> >
>> >
>> > "Grant Schenck" wrote:
>> >
>> >> Hello,
>> >>
>> >> I have a VB script which is called by internet explorer in response to 
>> >> a
>> >> context menu selection.  I used the techinques in this article:
>> >>
>> >> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
>> >>
>> >> In my script, I can do lots of things but unlike VB scripts run from 
>> >> the
>> >> command line I can't do things like "wscript sleep 1000".  If I try I 
>> >> get
>> >> "Error: Object required: 'WScript'".
>> >>
>> >> So how can I use wscript features from an Internet Explorer VB script?
>> >>
>> >> Thanks!
>> >>
>> >> Grant Schenck
>> >>
>> >>
>> >> .
>> >>
>>
>>
>>
date: Tue, 28 Mar 2006 16:36:02 -0500   author:   Grant Schenck

Re: How can I use wscript.sleep from Internet Explorer menu script   
Here it is in VBScript:
but I warn you, at the moment it is not working in IE7.0
(how can we make it work in IE7.0????)


#### pause.html #####
<HTML>
<BODY onload="test()">
<SCRIPT LANGUAGE="VBScript">
Function pause(numberMillis) 
	Dim dialogScript
	dialogScript = "window.setTimeout(" & " function () { window.close(); }, " 
& numberMillis & ");" 
	window.showModalDialog("javascript:document.writeln(" & """<script>" & 
dialogScript & "<" + "/script>"")")
End Function

Function test()
	window.alert("Start")
	pause (3000)
	window.alert("End after (about) 3 seconds")
End Function
</SCRIPT>
</BODY>
</HTML>

#####################
(javascript: is now used but there is no doubt it could be converted to 
vbscript: 
 but this is just an example...

good luck!






"Grant Schenck" wrote:

> Any idea of how I'd do this from a VB Script?
> -- 
> Grant Schenck
> 
> "Robin P"  wrote in message 
> news:26066040-0A27-4C7E-BAE3-924F35600395@microsoft.com...
> >
> > In 6.0 you can simulate a sleep with javascript:
> > function pause(numberMillis) {
> > var dialogScript = 'window.setTimeout(' + ' function () { window.close();
> > }, ' + numberMillis + ');';
> > getWindow().showModalDialog('javascript:document.writeln(' + '"<script>' +
> > dialogScript + '<' + '/script>")');
> > }
> >
> > this is the only real working sleep function.
> >
> > The 'simulation' with timer functions is not a real sleep at all.
> > (Unfortunately.)
> >
> > Well, in IE7.0, the sleep function doesn't work anymore. So maybe you
> > shouldn't use it. I use it and probably a have to do a total rebuild of my
> > application when IE7.0 has no sleep functionality anymore.
> >
> > (I wonder why in al those years no standard sleep function is built in IE
> > (and FireFox),
> > with all the asynchronous XML requests and form post we lack a sleep
> > function.)
> >
> >
> >
> >
> > "Grant Schenck" wrote:
> >
> >> This looks like a possible solution, I'm not familiar with using timers 
> >> from
> >> VB script.
> >>
> >> Based on the code below, I'm not clear what the script is doing while 
> >> this
> >> periodic timer events happen?
> >>
> >> For example, presumably after I kick off some activity which I want to 
> >> check
> >> up on later I call your StartStatusTimer function.  Then what do I do? 
> >> What
> >> does the script wait on so that the timer interval task can get control?
> >>
> >> By the way, the COM object I'm interfacing with generates an event.  Can
> >> somehow handle that directly from VB script and if so, again, what does 
> >> is
> >> my script doing when it is in the mode waiting for events?
> >>
> >> Thanks!
> >> -- 
> >> Grant Schenck
> >> http://grantschenck.tripod.com
> >>
> >> "wimZ"  wrote in message
> >> news:1249C51B-CDDE-4110-8A13-35EF3B97E980@microsoft.com...
> >> >I use the timer for this.
> >> >
> >> > you'll have to cut the process in two (or more if you want to use the
> >> > sleep
> >> > more often.
> >> > Or alternatively make your function state driven, which so that it can 
> >> > be
> >> > be
> >> > called multiple times and depending on a global state will process a
> >> > different section of your code.
> >> > Below is an example of how I do it, All you need to do is replace
> >> > YourFunction in the function ItsTime and from your code you call
> >> > StartProcess(Yourfunction) and
> >> >
> >> > (I have clipped it out of existing code, I think it will function as 
> >> > is,
> >> > but
> >> > maybe overlooked something.
> >> >
> >> >
> >> > dim gStatusTimer
> >> > Function StartStatusTimer
> >> >   if gStatusTimer = 0 Then
> >> >      gStatusTimer = window.setInterval("ItsTime()", 1000)
> >> >   End If
> >> > End Function
> >> >
> >> > Function StopStatusTimer
> >> >   if gStatusTimer <> 0 Then
> >> >      window.clearInterval gStatusTimer>      gStatusTimer = 0
> >> >   end If
> >> > End Function
> >> >
> >> > Dim gProcessName
> >> > Sub StartProcess(sProcessName)
> >> >   gProcessName = sProcessName
> >> > End Sub
> >> >
> >> > Function AtLeastOneMachineInstalling
> >> >   AtLeastOneMachineInstalling = True
> >> > End Function
> >> >
> >> > Function ItsTime
> >> >   'Stop the timer to avoid a timer event during a lengthy process.
> >> >   StopStatusTimer
> >> >
> >> >   If Len(gProcessName) > 0 Then
> >> >      sTemp = gProcessName
> >> >      gProcessName = ""
> >> >
> >> >      Select Case sTemp
> >> >      Case "YourFunction"
> >> >         YourFunction
> >> >      Case Else
> >> >         Msgbox "Programming error: process called: " & sTemp
> >> >      End Select
> >> >   End If
> >> >
> >> >   StartStatusTimer
> >> > End Function
> >> >
> >> >
> >> > "Grant Schenck" wrote:
> >> >
> >> >> Hello,
> >> >>
> >> >> I have a VB script which is called by internet explorer in response to 
> >> >> a
> >> >> context menu selection.  I used the techinques in this article:
> >> >>
> >> >> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
> >> >>
> >> >> In my script, I can do lots of things but unlike VB scripts run from 
> >> >> the
> >> >> command line I can't do things like "wscript sleep 1000".  If I try I 
> >> >> get
> >> >> "Error: Object required: 'WScript'".
> >> >>
> >> >> So how can I use wscript features from an Internet Explorer VB script?
> >> >>
> >> >> Thanks!
> >> >>
> >> >> Grant Schenck
> >> >>
> >> >>
> >> >> .
> >> >>
> >>
> >>
> >> 
> 
> 
>
date: Wed, 29 Mar 2006 14:39:02 -0800   author:   Robin P

Re: How can I use wscript.sleep from Internet Explorer menu script   
I'm running version 6.0 but I get "object doesn't support this property or 
method: 'window.showModalDialog'.

Any ideas?

Thanks
-- 
Grant Schenck

"Robin P"  wrote in message 
news:5854883F-54CA-4A57-B24F-230E642D44F9@microsoft.com...
> Here it is in VBScript:
> but I warn you, at the moment it is not working in IE7.0
> (how can we make it work in IE7.0????)
>
>
> #### pause.html #####
> <HTML>
> <BODY onload="test()">
> <SCRIPT LANGUAGE="VBScript">
> Function pause(numberMillis)
> Dim dialogScript
> dialogScript = "window.setTimeout(" & " function () { window.close(); }, "
> & numberMillis & ");"
> window.showModalDialog("javascript:document.writeln(" & """<script>" &
> dialogScript & "<" + "/script>"")")
> End Function
>
> Function test()
> window.alert("Start")
> pause (3000)
> window.alert("End after (about) 3 seconds")
> End Function
> </SCRIPT>
> </BODY>
> </HTML>
>
> #####################
> (javascript: is now used but there is no doubt it could be converted to
> vbscript:
> but this is just an example...
>
> good luck!
>
>
>
>
>
>
> "Grant Schenck" wrote:
>
>> Any idea of how I'd do this from a VB Script?
>> -- 
>> Grant Schenck
>>
>> "Robin P"  wrote in message
>> news:26066040-0A27-4C7E-BAE3-924F35600395@microsoft.com...
>> >
>> > In 6.0 you can simulate a sleep with javascript:
>> > function pause(numberMillis) {
>> > var dialogScript = 'window.setTimeout(' + ' function () { 
>> > window.close();
>> > }, ' + numberMillis + ');';
>> > getWindow().showModalDialog('javascript:document.writeln(' + 
>> > '"<script>' +
>> > dialogScript + '<' + '/script>")');
>> > }
>> >
>> > this is the only real working sleep function.
>> >
>> > The 'simulation' with timer functions is not a real sleep at all.
>> > (Unfortunately.)
>> >
>> > Well, in IE7.0, the sleep function doesn't work anymore. So maybe you
>> > shouldn't use it. I use it and probably a have to do a total rebuild of 
>> > my
>> > application when IE7.0 has no sleep functionality anymore.
>> >
>> > (I wonder why in al those years no standard sleep function is built in 
>> > IE
>> > (and FireFox),
>> > with all the asynchronous XML requests and form post we lack a sleep
>> > function.)
>> >
>> >
>> >
>> >
>> > "Grant Schenck" wrote:
>> >
>> >> This looks like a possible solution, I'm not familiar with using 
>> >> timers
>> >> from
>> >> VB script.
>> >>
>> >> Based on the code below, I'm not clear what the script is doing while
>> >> this
>> >> periodic timer events happen?
>> >>
>> >> For example, presumably after I kick off some activity which I want to
>> >> check
>> >> up on later I call your StartStatusTimer function.  Then what do I do?
>> >> What
>> >> does the script wait on so that the timer interval task can get 
>> >> control?
>> >>
>> >> By the way, the COM object I'm interfacing with generates an event. 
>> >> Can
>> >> somehow handle that directly from VB script and if so, again, what 
>> >> does
>> >> is
>> >> my script doing when it is in the mode waiting for events?
>> >>
>> >> Thanks!
>> >> -- 
>> >> Grant Schenck
>> >> http://grantschenck.tripod.com
>> >>
>> >> "wimZ"  wrote in message
>> >> news:1249C51B-CDDE-4110-8A13-35EF3B97E980@microsoft.com...
>> >> >I use the timer for this.
>> >> >
>> >> > you'll have to cut the process in two (or more if you want to use 
>> >> > the
>> >> > sleep
>> >> > more often.
>> >> > Or alternatively make your function state driven, which so that it 
>> >> > can
>> >> > be
>> >> > be
>> >> > called multiple times and depending on a global state will process a
>> >> > different section of your code.
>> >> > Below is an example of how I do it, All you need to do is replace
>> >> > YourFunction in the function ItsTime and from your code you call
>> >> > StartProcess(Yourfunction) and
>> >> >
>> >> > (I have clipped it out of existing code, I think it will function as
>> >> > is,
>> >> > but
>> >> > maybe overlooked something.
>> >> >
>> >> >
>> >> > dim gStatusTimer
>> >> > Function StartStatusTimer
>> >> >   if gStatusTimer = 0 Then
>> >> >      gStatusTimer = window.setInterval("ItsTime()", 1000)
>> >> >   End If
>> >> > End Function
>> >> >
>> >> > Function StopStatusTimer
>> >> >   if gStatusTimer <> 0 Then
>> >> >      window.clearInterval gStatusTimer>      gStatusTimer = 0
>> >> >   end If
>> >> > End Function
>> >> >
>> >> > Dim gProcessName
>> >> > Sub StartProcess(sProcessName)
>> >> >   gProcessName = sProcessName
>> >> > End Sub
>> >> >
>> >> > Function AtLeastOneMachineInstalling
>> >> >   AtLeastOneMachineInstalling = True
>> >> > End Function
>> >> >
>> >> > Function ItsTime
>> >> >   'Stop the timer to avoid a timer event during a lengthy process.
>> >> >   StopStatusTimer
>> >> >
>> >> >   If Len(gProcessName) > 0 Then
>> >> >      sTemp = gProcessName
>> >> >      gProcessName = ""
>> >> >
>> >> >      Select Case sTemp
>> >> >      Case "YourFunction"
>> >> >         YourFunction
>> >> >      Case Else
>> >> >         Msgbox "Programming error: process called: " & sTemp
>> >> >      End Select
>> >> >   End If
>> >> >
>> >> >   StartStatusTimer
>> >> > End Function
>> >> >
>> >> >
>> >> > "Grant Schenck" wrote:
>> >> >
>> >> >> Hello,
>> >> >>
>> >> >> I have a VB script which is called by internet explorer in response 
>> >> >> to
>> >> >> a
>> >> >> context menu selection.  I used the techinques in this article:
>> >> >>
>> >> >> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
>> >> >>
>> >> >> In my script, I can do lots of things but unlike VB scripts run 
>> >> >> from
>> >> >> the
>> >> >> command line I can't do things like "wscript sleep 1000".  If I try 
>> >> >> I
>> >> >> get
>> >> >> "Error: Object required: 'WScript'".
>> >> >>
>> >> >> So how can I use wscript features from an Internet Explorer VB 
>> >> >> script?
>> >> >>
>> >> >> Thanks!
>> >> >>
>> >> >> Grant Schenck
>> >> >>
>> >> >>
>> >> >> .
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>
date: Thu, 30 Mar 2006 09:26:48 -0500   author:   Grant Schenck

Re: How can I use wscript.sleep from Internet Explorer menu script   
No,

maybe you did a copy and paste, make sure the newlines are at the right 
place( they are not at the right place after copy/paste)
it works for me (in IE 6.0)

so it should work for you.








"Grant Schenck" wrote:

> I'm running version 6.0 but I get "object doesn't support this property or 
> method: 'window.showModalDialog'.
> 
> Any ideas?
> 
> Thanks
> -- 
> Grant Schenck
> 
> "Robin P"  wrote in message 
> news:5854883F-54CA-4A57-B24F-230E642D44F9@microsoft.com...
> > Here it is in VBScript:
> > but I warn you, at the moment it is not working in IE7.0
> > (how can we make it work in IE7.0????)
> >
> >
> > #### pause.html #####
> > <HTML>
> > <BODY onload="test()">
> > <SCRIPT LANGUAGE="VBScript">
> > Function pause(numberMillis)
> > Dim dialogScript
> > dialogScript = "window.setTimeout(" & " function () { window.close(); }, "
> > & numberMillis & ");"
> > window.showModalDialog("javascript:document.writeln(" & """<script>" &
> > dialogScript & "<" + "/script>"")")
> > End Function
> >
> > Function test()
> > window.alert("Start")
> > pause (3000)
> > window.alert("End after (about) 3 seconds")
> > End Function
> > </SCRIPT>
> > </BODY>
> > </HTML>
> >
> > #####################
> > (javascript: is now used but there is no doubt it could be converted to
> > vbscript:
> > but this is just an example...
> >
> > good luck!
> >
> >
> >
> >
> >
> >
> > "Grant Schenck" wrote:
> >
> >> Any idea of how I'd do this from a VB Script?
> >> -- 
> >> Grant Schenck
> >>
> >> "Robin P"  wrote in message
> >> news:26066040-0A27-4C7E-BAE3-924F35600395@microsoft.com...
> >> >
> >> > In 6.0 you can simulate a sleep with javascript:
> >> > function pause(numberMillis) {
> >> > var dialogScript = 'window.setTimeout(' + ' function () { 
> >> > window.close();
> >> > }, ' + numberMillis + ');';
> >> > getWindow().showModalDialog('javascript:document.writeln(' + 
> >> > '"<script>' +
> >> > dialogScript + '<' + '/script>")');
> >> > }
> >> >
> >> > this is the only real working sleep function.
> >> >
> >> > The 'simulation' with timer functions is not a real sleep at all.
> >> > (Unfortunately.)
> >> >
> >> > Well, in IE7.0, the sleep function doesn't work anymore. So maybe you
> >> > shouldn't use it. I use it and probably a have to do a total rebuild of 
> >> > my
> >> > application when IE7.0 has no sleep functionality anymore.
> >> >
> >> > (I wonder why in al those years no standard sleep function is built in 
> >> > IE
> >> > (and FireFox),
> >> > with all the asynchronous XML requests and form post we lack a sleep
> >> > function.)
> >> >
> >> >
> >> >
> >> >
> >> > "Grant Schenck" wrote:
> >> >
> >> >> This looks like a possible solution, I'm not familiar with using 
> >> >> timers
> >> >> from
> >> >> VB script.
> >> >>
> >> >> Based on the code below, I'm not clear what the script is doing while
> >> >> this
> >> >> periodic timer events happen?
> >> >>
> >> >> For example, presumably after I kick off some activity which I want to
> >> >> check
> >> >> up on later I call your StartStatusTimer function.  Then what do I do?
> >> >> What
> >> >> does the script wait on so that the timer interval task can get 
> >> >> control?
> >> >>
> >> >> By the way, the COM object I'm interfacing with generates an event. 
> >> >> Can
> >> >> somehow handle that directly from VB script and if so, again, what 
> >> >> does
> >> >> is
> >> >> my script doing when it is in the mode waiting for events?
> >> >>
> >> >> Thanks!
> >> >> -- 
> >> >> Grant Schenck
> >> >> http://grantschenck.tripod.com
> >> >>
> >> >> "wimZ"  wrote in message
> >> >> news:1249C51B-CDDE-4110-8A13-35EF3B97E980@microsoft.com...
> >> >> >I use the timer for this.
> >> >> >
> >> >> > you'll have to cut the process in two (or more if you want to use 
> >> >> > the
> >> >> > sleep
> >> >> > more often.
> >> >> > Or alternatively make your function state driven, which so that it 
> >> >> > can
> >> >> > be
> >> >> > be
> >> >> > called multiple times and depending on a global state will process a
> >> >> > different section of your code.
> >> >> > Below is an example of how I do it, All you need to do is replace
> >> >> > YourFunction in the function ItsTime and from your code you call
> >> >> > StartProcess(Yourfunction) and
> >> >> >
> >> >> > (I have clipped it out of existing code, I think it will function as
> >> >> > is,
> >> >> > but
> >> >> > maybe overlooked something.
> >> >> >
> >> >> >
> >> >> > dim gStatusTimer
> >> >> > Function StartStatusTimer
> >> >> >   if gStatusTimer = 0 Then
> >> >> >      gStatusTimer = window.setInterval("ItsTime()", 1000)
> >> >> >   End If
> >> >> > End Function
> >> >> >
> >> >> > Function StopStatusTimer
> >> >> >   if gStatusTimer <> 0 Then
> >> >> >      window.clearInterval gStatusTimer>      gStatusTimer = 0
> >> >> >   end If
> >> >> > End Function
> >> >> >
> >> >> > Dim gProcessName
> >> >> > Sub StartProcess(sProcessName)
> >> >> >   gProcessName = sProcessName
> >> >> > End Sub
> >> >> >
> >> >> > Function AtLeastOneMachineInstalling
> >> >> >   AtLeastOneMachineInstalling = True
> >> >> > End Function
> >> >> >
> >> >> > Function ItsTime
> >> >> >   'Stop the timer to avoid a timer event during a lengthy process.
> >> >> >   StopStatusTimer
> >> >> >
> >> >> >   If Len(gProcessName) > 0 Then
> >> >> >      sTemp = gProcessName
> >> >> >      gProcessName = ""
> >> >> >
> >> >> >      Select Case sTemp
> >> >> >      Case "YourFunction"
> >> >> >         YourFunction
> >> >> >      Case Else
> >> >> >         Msgbox "Programming error: process called: " & sTemp
> >> >> >      End Select
> >> >> >   End If
> >> >> >
> >> >> >   StartStatusTimer
> >> >> > End Function
> >> >> >
> >> >> >
> >> >> > "Grant Schenck" wrote:
> >> >> >
> >> >> >> Hello,
> >> >> >>
> >> >> >> I have a VB script which is called by internet explorer in response 
> >> >> >> to
> >> >> >> a
> >> >> >> context menu selection.  I used the techinques in this article:
> >> >> >>
> >> >> >> http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/context.asp
> >> >> >>
> >> >> >> In my script, I can do lots of things but unlike VB scripts run 
> >> >> >> from
> >> >> >> the
> >> >> >> command line I can't do things like "wscript sleep 1000".  If I try 
> >> >> >> I
> >> >> >> get
> >> >> >> "Error: Object required: 'WScript'".
> >> >> >>
> >> >> >> So how can I use wscript features from an Internet Explorer VB 
> >> >> >> script?
> >> >> >>
> >> >> >> Thanks!
> >> >> >>
> >> >> >> Grant Schenck
> >> >> >>
> >> >> >>
> >> >> >> .
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
>
date: Fri, 31 Mar 2006 03:26:02 -0800   author:   Robin P

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us