Quantcast
Channel: VMware Communities : All Content - VMware® ThinApp®
Viewing all articles
Browse latest Browse all 1382

problem in vbscript in ThinApp

$
0
0

Hi All,

 

I am working on application AWD Encorr. In that I have an issue to delay one executable. First the exe gets launched then it does some it's operations and when done that executable should be closed and after that one folder needs to be deleted. All of logic is working fine but I need to give delay to executable. I tried all possible functions of VBScript like sleep, Ping command etc. but none of them is working. Can you please help me where exactly is going wrong. Please find below script.

 

Function OnFirstParentExit
                Dim objWMIService, objWMIProcess, WshShell, ObjFSO, WSHNetwork
                Dim colWMIProcess
                Dim strTitle, strMessage, strComputer, strProcessB, strProcessA, sFolder, StrAppdata
                Dim intButton, strcmd

        Set WSHNetwork = CreateObject("WScript.Network")
        Set WSHShell = CreateObject("WScript.Shell")
        Set objFSO = CreateObject("Scripting.FileSystemObject")

                ' Set computer to localhost
                strComputer = "."
                ' Set process to check

                StrAppdata = WshShell.ExpandEnvironmentStrings("%APPDATA%")
                sFolder = StrAppdata & "\Microsoft\Windows\Start Menu\Programs\Awd Main"
'               intSleepTime = 0.25*60*1000
                strProcessA = "Awd logon.exe"
                strProcessB = "Awdlogon.exe"
        Do

                                Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
                                Set colWMIProcess = objWMIService.ExecQuery("Select * from Win32_Process Where Name='" & strProcessA & "'")
                  If colWMIProcess.Count>0 then
                                                msgbox "Process Awd logon.exe running"
                                 else                                                  
                                                msgbox "Process Awd logon.exe not found for user"
                                                Exit Do
                                 end if
                                Strcmd = "%COMSPEC% /c ping -n " & 20 & " 127.0.0.1>nul"
                                wshshell.run strcmd,0,1
                Loop
        Do
                                Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
                                Set colWMIProcess = objWMIService.ExecQuery("Select * from Win32_Process Where Name='" & strProcessB & "'")
                  If colWMIProcess.Count>0 then
                                                msgbox "Process Awdlogon.exe exists"
                                 else                                                  
                                                msgbox "Process Awdlogon.exe not found for user delete the folder."
                                                                If ObjFSO.FolderExists(sFolder) Then
                                                                ObjFSO.DeleteFolder sFolder, True
                                                                End If

                                                               Exit Do
                                end if


                Loop
                Set objWMIService = nothing
         Set colProcessList = nothing
                set WshShell = nothing
                set WSHSFSO = nothing

End Function


Viewing all articles
Browse latest Browse all 1382

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>