Re: System sleep
From: Michael Harris \(MVP\) ("Michael)
Date: 11/14/04
- Next message: Michael Harris \(MVP\): "Re: How can I do VB 'Like' by using vbscript?"
- Previous message: Michael Harris \(MVP\): "Re: WSC and FileSystemObject Constants"
- Maybe in reply to: Charles E Finkenbiner: "Re: System sleep"
- Next in thread: Michael Harris \(MVP\): "Re: System sleep"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 14 Nov 2004 13:40:17 -0800
Pippen wrote:
> Here is a code snippet that works but I'm looking for something that
> is not so CPU intensive to perform a sleep. The problem is that I
> have to decrypt a PGP program using the CmdShell. Once the file is
> decrypted I want to move the encrypted file to another directory.
> What I have done is create my own little timer delay that hit's the
> CPU harder than it should. Is there a way to use a sleep function
> that will wait without hitting the CPU. The reason I need the sleep
> funtion is that the VBScript does not wait for the CmdShell program
> to finish and moves the file before PGP can decrypt it... Note the
> variables and objects are created in other parts of the code; this is
> an incomplete snippet of code.
>
> VBScript is not my primary language, I use VBScript exclusively in DTS
> packages on MS SQL 2000 as an ActiveX step. Does anybody know a good
> book or site that deals with this aspect of VBScript. Every book or
> resource I have seen deals primarily with web pages.
I'd suggest you simply use
objShell.Run strCmdDecryptFiles,0,true 'hidden window, wait for
completion...
rather than
Set objScriptExec = objShell.Exec(strCmdDecryptFiles)
especially since you do not appear to make use of the features of the
objScriptExec object. I would do this even in a WSH hosted script where
WScript.Sleep is available (which is not available in your SQL/DTS
environment).
>
> Thanks,
>
> -p
>
>
> If objFSO.FileExists(strFileNameBko) Then
> 'Decrypt the file and remove the .pgp from the end
> strBKOoutput = Mid(strFileNameBko,1,Len(strFileNameBko) - 4)
> strCmdDecryptFiles = strGPGPathFile + " --output " + strBKOoutput
> + --decrypt " + strFileNameBko
> Set objScriptExec = objShell.Exec(strCmdDecryptFiles)
>
> -- BEGIN OFFENDING CODE
> ' have to slow it down moving the file before being decrypted
> TimeBKO = Now
> While DiffBKOTime < intSleepSeconds
> if objFSO.FileExists(strBKOoutput) Then
> DiffBKOTime = DateDiff("S", TimeBKO, Now)
> End If
> WEnd
> -- END OFFENDING CODE
>
> 'Move Encrypted file to DTS Global defined directory
> set FileToMove = objFSO.GetFile(strFileNameBko)
> FileToMove.Move(strEncryptedReturnFilesPath)
>
> End If
-- Michael Harris Microsoft.MVP.Scripting Sammamish WA US
- Next message: Michael Harris \(MVP\): "Re: How can I do VB 'Like' by using vbscript?"
- Previous message: Michael Harris \(MVP\): "Re: WSC and FileSystemObject Constants"
- Maybe in reply to: Charles E Finkenbiner: "Re: System sleep"
- Next in thread: Michael Harris \(MVP\): "Re: System sleep"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|