VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Open Local Url with IE object (https://forums.vandyke.com/showthread.php?t=13404)

Nico 02-15-2019 05:01 AM

Open Local Url with IE object
 
Hello,

I have a problem :

When I Run the following code, with a web URL I have not erros :

#$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 "www.google.fr"
' 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 = 500
g_objIE.width = 700
' Set the title of the IE window
g_objIE.document.Title = "Sofrastock Welcomme"

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("Username").Focus

' Wait for user interaction with the dialog...
crt.Sleep 200



But when I try to Run the same code with a local URL , I have Unknown errors.
Why does this happen?

Thank you :)

ekoranyi 02-15-2019 09:15 AM

Hi Nico,

I'm sorry to hear you're having trouble.

What version of SecureCRT are you running?

To get a better picture of what is happening I would like to gather some additional information. Can you elaborate on what you mean by local URL? What is the exact error message you're seeing?

Nico 02-20-2019 02:26 AM

Hello,

Thank you for your answer,

my version of SecureCRT : 6[1].1.1


When I try with this 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 "www.google.fr"
' 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 = "Sofrastock Welcomme"

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("Username").Focus

' Wait for user interaction with the dialog...
crt.Sleep 200

I don't have any erraters and the web page "google" is displayed

And with local url, using wampserver, I have this error :

Error: UNknown error
File: D:\name.vbs
Line: 11

code who generate this error :

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://localhost/demo/public/reference"
' 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 = "Sofrastock Welcomme"

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("Username").Focus

' Wait for user interaction with the dialog...
crt.Sleep 200

Thank you

ekoranyi 02-20-2019 01:24 PM

Hi Nico,

If you manually open Internet Explorer and enter the address "http://localhost/demo/public/reference" are you able to successfully connect?

If you replace localhost with the IP address of your machine does that change the behavior you see?

Code:

"http://<local IP address>/demo/public/reference"

Nico 02-21-2019 02:34 AM

Open local Url
 
Hello,

Thank you for your answer


Yes if I open Internet explorer and enter the adress : "http://localhost/demo/public/reference" I'm able to successfully connect


If I replace localhost with my IP address I have this error when the web page is displayed : 403 Forbidden

thank you.

Nico 02-21-2019 04:44 AM

Open local Url
 
Hello,

I just configure my local server wamp, with my address IP and it's run successfully !

Thank you very much for your help !


All times are GMT -6. The time now is 06:13 PM.