VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Get Description of saved session via script (https://forums.vandyke.com/showthread.php?t=12947)

DeeZ 12-18-2017 01:22 AM

Get Description of saved session via script
 
1 Attachment(s)
Hello.
I have some useful info in saves session (see atttach).

I'd like to get this info into my script.
How can I get it? What property store this?

ekoranyi 12-18-2017 10:10 AM

Hi DeeZ,

Text entered in the Description field is stored in the session ini file in the Description field. You can access this data using something like:
Code:

# $language = "VBScript"
# $interface = "1.0"

Set objTab = crt.GetScriptTab
Set objConfig = objTab.Session.Config
strDescription = Join(objConfig.GetOption("Description"))

crt.Dialog.MessageBox(strDescription)

Does this help get you the functionality you're looking for?

DeeZ 12-18-2017 09:30 PM

Quote:

Originally Posted by ekoranyi (Post 48714)
Does this help get you the functionality you're looking for?

Yes! Excelent. Thank you.

I use Python:
Code:

# $language = "Python"
# $interface = "1.0"
import SecureCRT

def main():
    ScriptTab = crt.GetScriptTab()
    config = ScriptTab.Session.Config
    Description = ''
    for line in config.GetOption("Description"):
        Description = Description + '\n' + line
    crt.Dialog.MessageBox(Description)

main()


ekoranyi 12-19-2017 09:09 AM

Hi DeeZ,

I'm glad to hear you were able to get access to the data you needed.

Have a great rest of the day.


All times are GMT -6. The time now is 05:57 PM.