#1
|
|||
|
|||
Open Url in foreground
Hello,
I want to displayed the web page in foregroud the code: Code:
#$language = "VBScript" #$interface = "1.0" ' Get a reference to IE's Application object Set g_objIE = CreateObject("InternetExplorer.Application") 'g_objIE.Offline = True g_objIE.Offline = False g_objIE.navigate "http://lochalost/demo/public/ref" ' This loop is required to allow the IE object to finish loading... Do crt.Sleep 100 Loop While g_objIE.Busy ' Prevent the MenuBar, StatusBar, AddressBar, and Toolbar from ' being displayed as part of the IE window g_objIE.MenuBar = False g_objIE.StatusBar = False g_objIE.AddressBar = False g_objIE.Toolbar = False ' Set the initial size of the IE window g_objIE.height = 400 g_objIE.width = 425 ' Set the title of the IE window g_objIE.document.Title = "SFK" g_objIE.Visible = True ' This loop is required to allow the IE window to fully display ' before moving on Do crt.Sleep 100 Loop While g_objIE.Busy ' This code brings the IE window to the foreground (otherwise, the window ' would appear, but it would likely be behind the SecureCRT window, not ' easily visible to the user). Set objShell = CreateObject("WScript.Shell") objShell.AppActivate g_objIE.document.Title ' Once the dialog is displayed and has been brought to the ' foreground, set focus on the control of our choice... g_objIE.Document.All("ref").Value= "uguigio" g_objIE.Document.All("ref").Focus crt.Screen.SendKeys "{ENTER}" ' Wait for user interaction with the dialog... crt.Sleep 200 The web page does not appear in the foreground with this code Thank you for your help Last edited by ekoranyi; 02-21-2019 at 08:29 AM. |
#2
|
|||
|
|||
Hi Nico,
The issue you're experiencing is not specific to SecureCRT, this is an issue with VBScript and the Internet Explorer object. Removing all SecureCRT specific code, crt.Sleep and crt.Screen.SendKeys, would likely result in the same behavior. You can test this by replacing crt.Sleep with WScript.Sleep and running the script outside of SecureCRT. I've included a modified version of your script below, simply save it to your desktop and double click it to run. Code:
' Get a reference to IE's Application object Set g_objIE = CreateObject("InternetExplorer.Application") 'g_objIE.Offline = True g_objIE.Offline = False g_objIE.navigate "www.google.com" ' This loop is required to allow the IE object to finish loading... Do WScript.Sleep 100 Loop While g_objIE.Busy ' Prevent the MenuBar, StatusBar, AddressBar, and Toolbar from ' being displayed as part of the IE window g_objIE.MenuBar = False g_objIE.StatusBar = False g_objIE.AddressBar = False g_objIE.Toolbar = False ' Set the initial size of the IE window g_objIE.height = 400 g_objIE.width = 425 ' Set the title of the IE window g_objIE.document.Title = "SFK" g_objIE.Visible = True ' This loop is required to allow the IE window to fully display ' before moving on Do WScript.Sleep 100 Loop While g_objIE.Busy ' This code brings the IE window to the foreground (otherwise, the window ' would appear, but it would likely be behind the SecureCRT window, not ' easily visible to the user). Set objShell = CreateObject("WScript.Shell") objShell.AppActivate g_objIE.document.Title ' Once the dialog is displayed and has been brought to the ' foreground, set focus on the control of our choice...
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|