This little app runs in a perpetual loop in the background – sleeping for 15 seconds. There is no safeguard that prevents multiple copies from running, so use it with caution.
Set wshShell = CreateObject("WScript.Shell")
Do
ret = wshShell.AppActivate("QuickBooks Desktop Login")
If ret = True Then
wshShell.SendKeys "%{F4}"
'Exit Do
End If
ret = wshShell.AppActivate("Intuit account")
If ret = True Then
wshShell.SendKeys "%{F4}"
'Exit Do
End If
WScript.Sleep 15000
Loop
If the user doesn’t have the need for any other vbscripts to run, they can use this version to prevent multiple copies of the pop-up blocker from running accidentally.
Set objServices = _
GetObject("winmgmts:{impersonationLevel=impersonate}!root\cimv2")
'create an the instance of the Win32_Process class
Set objWMIObjects = objServices.InstancesOf("Win32_Process")
'loop through each process and list the handle and executable
For Each objWMIObject In objWMIObjects
If Instr(objWMIObject.ExecutablePath ,"WScript") > 0 Then
nWSHCount = nWSHCount + 1
End If
Next
'if number of instances of Cscript is greater than 1,
' exit script
If nWSHCount > 1 Then
Leave()
Else
Launch()
End If
Function Launch()
Set wshShell = CreateObject("WScript.Shell")
Do
ret = wshShell.AppActivate("QuickBooks Desktop Login")
If ret = True Then
wshShell.SendKeys "%{F4}"
'Exit Do
End If
ret = wshShell.AppActivate("Intuit account")
If ret = True Then
wshShell.SendKeys "%{F4}"
'Exit Do
End If
WScript.Sleep 15000
Loop
End Function
Function Leave()
MsgBox "QuickBooks pop-up blocker is already running."
WScript.Quit 1
End Function