#1
|
|||
|
|||
Get session ip addres
Hi!
How can i get ip address of the session? I need to do is something like: If Session IP is "192.168." Then MsgBox "Ok" Else MsgBox "Bad" End If |
#2
|
|||
|
|||
Hi sind,
Thanks for the question. If you are connected to the session you could use the RemoteAddress property of the Session object. Would this work for you? If not, can you provide more specific details about your goal? Last edited by rtb; 02-25-2013 at 08:40 AM. |
#3
|
|||
|
|||
I have a devices of different vendors in the different subnets. And I want to connect them with a script.
Login prompt they have the same. So I want to identify them at the session IP. Example: Code:
If Session IP is "192.168." Then crt.Screen.WaitForString "Login:" objTab.Screen.Send login1 & vbcr crt.Screen.WaitForString "Password:" objTab.Screen.Send password1 & vbcr Else If Session IP is "10.0." Then crt.Screen.WaitForString "Login:" objTab.Screen.Send login2 & vbcr crt.Screen.WaitForString "Password:" objTab.Screen.Send password2 & vbcr End If |
#4
|
|||
|
|||
Hi sind,
How are you going to be running this script? How does the script know what session is being used to connect? |
#5
|
|||
|
|||
This script is set to the default session in program. I type IP address to connect bar and script starting.
|
#6
|
|||
|
|||
Hello sind,
Thanks for the information. This sounds like it might be useful for other users, so here is an example: Code:
' Get handle to ad hoc session in tab created by script Set objTab = crt.GetScriptTab ' Get handle to the configuration for the session Set objConfig = crt.Session.Config ' Take action depending on the IP address of the session If InStr(objConfig.GetOption("Hostname"), "192.168") Then objTab.Screen.Synchronous = True objTab.Screen.Send "user1" & vbcr objTab.Screen.WaitForString "word:" objTab.Screen.Send "pass1" & vbcr Else objTab.Screen.Synchronous = True objTab.Screen.Send "user2" & vbcr objTab.Screen.WaitForString "word:" objTab.Screen.Send "pass2" & vbcr End If Does this help you accomplish your goal? Last edited by rtb; 02-25-2013 at 02:16 PM. |
#7
|
|||
|
|||
![]()
Thanks. Works fine.
|
#8
|
|||
|
|||
Hi sind,
Thanks for the confirmation. For those that see this and want to use it, it is necessary to define the script as a Logon script: in the Default Session. It is also necessary to enable Display logon prompts in terminal window. You can edit the Default Session by pressing the Edit Default Settings... button in the General / Default Session category of the Global Options dialog. Once you see the following dialog, select Change Default session only: --------------------------- |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|