Sleep Function & FileSystemObject 
Author Message
 Sleep Function & FileSystemObject

Hi

I am copying a bunch of files usinf VBS and FileSystemObject and am
trying to inform the user of what is going on at the time but the form
locks up until the copy is complete. As there is no DoEvents I am
trying to use the sleep command.

MSDN states use it in the following context:

   WScript.Sleep 100

Unfortunately the script does not want to know giving the error:

  Object Required "WScript"

I think my problem is in the way i am setting the FileSystemObject up
but I am not sure:

   Set FileSystemObject = CreateObject("Scripting.FileSystemObject")

Any ideas would be greatly appreciated

Thanks

Tom



Sat, 10 Apr 2004 18:47:09 GMT  
 Sleep Function & FileSystemObject
You need to add an object for the script shell
as:  set wshShell = CreateObject("Wscript.Shell")
along with you fso.  Then you can use the WScript.Sleep.

Edward

Quote:
>-----Original Message-----
>Hi

>I am copying a bunch of files usinf VBS and

FileSystemObject and am
Quote:
>trying to inform the user of what is going on at the time
but the form
>locks up until the copy is complete. As there is no
DoEvents I am
>trying to use the sleep command.

>MSDN states use it in the following context:

>   WScript.Sleep 100

>Unfortunately the script does not want to know giving the
error:

>  Object Required "WScript"

>I think my problem is in the way i am setting the
FileSystemObject up
>but I am not sure:

>   Set FileSystemObject = CreateObject

("Scripting.FileSystemObject")

- Show quoted text -

Quote:

>Any ideas would be greatly appreciated

>Thanks

>Tom
>.



Sun, 11 Apr 2004 01:46:29 GMT  
 Sleep Function & FileSystemObject
Thank you so much...

I have seen that line in the MSDN but it was always then used to call
some sort of shell function. I have been trying to use it within the
set command of rht FSO object with no luck.

Cheers

Tom

On Tue, 23 Oct 2001 10:46:29 -0700, "Edward"

Quote:

>You need to add an object for the script shell
>as:  set wshShell = CreateObject("Wscript.Shell")
>along with you fso.  Then you can use the WScript.Sleep.

>Edward
>>-----Original Message-----
>>Hi

>>I am copying a bunch of files usinf VBS and
>FileSystemObject and am
>>trying to inform the user of what is going on at the time
>but the form
>>locks up until the copy is complete. As there is no
>DoEvents I am
>>trying to use the sleep command.

>>MSDN states use it in the following context:

>>   WScript.Sleep 100

>>Unfortunately the script does not want to know giving the
>error:

>>  Object Required "WScript"

>>I think my problem is in the way i am setting the
>FileSystemObject up
>>but I am not sure:

>>   Set FileSystemObject = CreateObject
>("Scripting.FileSystemObject")

>>Any ideas would be greatly appreciated

>>Thanks

>>Tom
>>.



Sun, 11 Apr 2004 01:59:38 GMT  
 Sleep Function & FileSystemObject
Edward

thanks, I have now added the line:

   Set WshShell = CreateObject("WScript.Shell")

When I run the command

  WScript.Sleep 100

I get the error:

  Object required 'WScript'

Any ideas why this is?

Thanks again

Tom

On Tue, 23 Oct 2001 10:46:29 -0700, "Edward"

Quote:

>set wshShell = CreateObject("Wscript.Shell")



Sun, 11 Apr 2004 02:09:32 GMT  
 Sleep Function & FileSystemObject
The Wscript object is only available to WSH hosted script (wscript/cscript.exe)...

This isn't going to help you anyway since FSO file operations are synchronous.  They don't return control to your script until they are done...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Edward

> thanks, I have now added the line:

>    Set WshShell = CreateObject("WScript.Shell")

> When I run the command

>   WScript.Sleep 100

> I get the error:

>   Object required 'WScript'

> Any ideas why this is?

> Thanks again

> Tom

> On Tue, 23 Oct 2001 10:46:29 -0700, "Edward"

> >set wshShell = CreateObject("Wscript.Shell")



Sun, 11 Apr 2004 02:59:28 GMT  
 Sleep Function & FileSystemObject

Quote:
>The Wscript object is only available to WSH hosted script (wscript/cscript.exe)...

>This isn't going to help you anyway since FSO file operations are synchronous.  They don't return control to your script until they are done...

That is fine, i am looping, copying a single file at at time with the
FSO, in between i want to be able to update controls on a form.

Is this at all possible?



Sun, 11 Apr 2004 16:55:04 GMT  
 Sleep Function & FileSystemObject
To use the sleep method of the WScript object, you need to create like FSO
first:
          set WshShell = CreateObject("WScript.Shell")
          wshshell.sleep 1000

However, I'm not sure whether or not the sleep method can help under your
situation.

Hope it helps.

Best Regards,
Robin Shen
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. Copy right, 2001 Microsoft Corporation.
All rights reserved.



Sun, 11 Apr 2004 19:28:10 GMT  
 Sleep Function & FileSystemObject

Quote:
>          set WshShell = CreateObject("WScript.Shell")
>          wshshell.sleep 1000

Robin thanks but I am running into the following on the sleep line:

   Error: Opject doesn't support this property or method
'WshShell.Sleep'

If it helps I am running it as a VBScript which forms part of an
Intranet web page. All users are running IE 5 or above.

Cheers

Tom



Sun, 11 Apr 2004 21:41:59 GMT  
 Sleep Function & FileSystemObject
Initially I think we can call the sleep method just like other WSH methods,
however it appears to be wrong after further research. Please reference the
article INFO: Certain WScript Methods and Properties Not Accessible in
Visual Basic at
http://support.microsoft.com/support/kb/articles/Q279/1/64.ASP, such
methods like Sleep and ect must be use under WSH environment  and can't be
used outside that such as VB, ASP, Web Page and etc.

Just for your reference, as far as I know we usually use the setTimeout
method of the window DHTML object to "sleep" some time, please reference
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/set...
asp for more info. Not sure whether or not it will help under your
situation.

Hope it helps.

Best Regards,
Robin Shen
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. Copy right, 2001 Microsoft Corporation.
All rights reserved.



Mon, 12 Apr 2004 09:16:48 GMT  
 Sleep Function & FileSystemObject
DHTML Dude: Updating the Display During Lengthy Operations
http://msdn.microsoft.com/voices/dude02262001.asp

--
Michael Harris
Microsoft.MVP.Scripting

Quote:

> >          set WshShell = CreateObject("WScript.Shell")
> >          wshshell.sleep 1000

> Robin thanks but I am running into the following on the sleep line:

>    Error: Opject doesn't support this property or method
> 'WshShell.Sleep'

> If it helps I am running it as a VBScript which forms part of an
> Intranet web page. All users are running IE 5 or above.

> Cheers

> Tom



Mon, 12 Apr 2004 09:34:23 GMT  
 Sleep Function & FileSystemObject
Hi

Wscript.Sleep will not give you any help to inform the user that something is
happening.

To get an idea to how to create an progress dialog, go to Jim Warringtons (fun
to read) Web site:

Using "pure" MS (equals IE controls):

http://home.att.net/~wshvbs/index.htm#UsingIEforDialogs

or if you are comfortable using notoriously untrustworthy and unreliable
third-party controls as Jim Warrington says it ;-)

http://home.att.net/~wshvbs/index.htm#wshLtWtNonModalDlg

Regards,
Torgeir

Quote:

> Hi

> I am copying a bunch of files usinf VBS and FileSystemObject and am
> trying to inform the user of what is going on at the time but the form
> locks up until the copy is complete. As there is no DoEvents I am
> trying to use the sleep command.

> MSDN states use it in the following context:

>    WScript.Sleep 100

> Unfortunately the script does not want to know giving the error:

>   Object Required "WScript"

> I think my problem is in the way i am setting the FileSystemObject up
> but I am not sure:

>    Set FileSystemObject = CreateObject("Scripting.FileSystemObject")

> Any ideas would be greatly appreciated

> Thanks

> Tom



Sun, 11 Apr 2004 02:05:29 GMT  
 Sleep Function & FileSystemObject
Thanks for the link - but the page cannot be found.

On Wed, 24 Oct 2001 18:34:23 -0700, "Michael Harris \(MVP\)"

Quote:

>DHTML Dude: Updating the Display During Lengthy Operations
>http://msdn.microsoft.com/voices/dude02262001.asp



Mon, 12 Apr 2004 23:50:21 GMT  
 Sleep Function & FileSystemObject
Well, why didn't you just put the title of the article into the search bar ;-)

Updating the Display During Lengthy Operations:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndu...

Regards,
Torgeir

Quote:

> Thanks for the link - but the page cannot be found.

> On Wed, 24 Oct 2001 18:34:23 -0700, "Michael Harris \(MVP\)"

> >DHTML Dude: Updating the Display During Lengthy Operations
> >http://msdn.microsoft.com/voices/dude02262001.asp



Tue, 13 Apr 2004 00:01:10 GMT  
 Sleep Function & FileSystemObject
Thanks - wow a result at last!


Tue, 13 Apr 2004 01:41:27 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. Replace Function & FileSystemObject problems

2. sleep function

3. I need simulate sleep() C function

4. Sleep function in vbscript????

5. sleep function

6. Sleep function

7. ASP sleep function

8. sleep function

9. Is there a Sleep function??

10. sleep function

11. Sleep function to run in vbscript?

12. Windows API Sleep function

 

 
Powered by phpBB® Forum Software