Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-21-2019, 09:22 AM
Nico Nico is offline
Registered User
 
Join Date: Feb 2019
Posts: 12
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 09:29 AM.
Reply With Quote
  #2  
Old 02-21-2019, 09:39 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
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...
Because this is not specific to SecureCRT, this is generally outside the scope of support we can provide. I would suggest seeking further assistance from a VBScript specific source.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 09:56 PM.