clif
06-10-2021, 10:17 PM
Sub abc()
Application.ScreenUpdating = False
Shell "wscript.exe ""C:\Users\abc\Desktop\abc.vbs"""
Set objShellApp = CreateObject("Shell.Application")
For Each objWindow In objShellApp.Windows
Debug.Print objWindow.LocationName
If LCase(objWindow.LocationName) = LCase("abc") Then
Debug.Print objWindow.LocationURL
If objWindow.LocationURL = "http://abc.aspx" Then
Set objIe = objWindow
GoTo Label8:
Else
GoTo Label9:
End If
Label9:
End If
Next
Label8:
objIe.document.all("button_Confirm").Click
'popup window appear all code cannot be run
<input name="btn$button_Confirm" id="button_Confirm" style="font-weight: bold;" onclick="return confirm('Checked & Confirmed?');WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("button_Confirm", "", true, "", "", false, false))" type="submit" value="Check & Confirm (Account)">
abc.vbs
Set wshShell = CreateObject("WScript.Shell")
Do
ret = wshShell.AppActivate("網頁訊息")
Loop Until ret = True
WScript.Sleep 5000
ret = wshShell.AppActivate("網頁訊息")
If ret = True Then
ret = wshSheel.AppActivate("網頁訊息")
WScript.Sleep 1000
wshShell.Sendkeys "{enter}"
End If
WScript.Sleep 500
Application.ScreenUpdating = False
Shell "wscript.exe ""C:\Users\abc\Desktop\abc.vbs"""
Set objShellApp = CreateObject("Shell.Application")
For Each objWindow In objShellApp.Windows
Debug.Print objWindow.LocationName
If LCase(objWindow.LocationName) = LCase("abc") Then
Debug.Print objWindow.LocationURL
If objWindow.LocationURL = "http://abc.aspx" Then
Set objIe = objWindow
GoTo Label8:
Else
GoTo Label9:
End If
Label9:
End If
Next
Label8:
objIe.document.all("button_Confirm").Click
'popup window appear all code cannot be run
<input name="btn$button_Confirm" id="button_Confirm" style="font-weight: bold;" onclick="return confirm('Checked & Confirmed?');WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("button_Confirm", "", true, "", "", false, false))" type="submit" value="Check & Confirm (Account)">
abc.vbs
Set wshShell = CreateObject("WScript.Shell")
Do
ret = wshShell.AppActivate("網頁訊息")
Loop Until ret = True
WScript.Sleep 5000
ret = wshShell.AppActivate("網頁訊息")
If ret = True Then
ret = wshSheel.AppActivate("網頁訊息")
WScript.Sleep 1000
wshShell.Sendkeys "{enter}"
End If
WScript.Sleep 500