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 08-18-2016, 09:15 AM
hawkandspit hawkandspit is offline
Registered User
 
Join Date: Jun 2015
Location: Lawrenceville, GA
Posts: 1
Persistent Variables

Is there a way create persistent variables that will retain their value across script invocations or, preferably, across SecureCRT sessions and invocations?

For example, I have a 'repeat command' script that prompts or a command and repeat interval, then repeatedly issues the command to the Screen object some number of seconds after the command prompt returns. I want these parameters to be remembered the next time the script is invoked. Ideally, this would include the next time SecureCrt is launched.

Also, the value should be tied to the connection.
Reply With Quote
  #2  
Old 08-18-2016, 12:10 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 938
There are a number of options to consider for obtaining "persistent" values that you'd like to use now and in the future.

Saving information to a file might be an option. One idea would be a single flat file that would be read in each time your script runs. Each line would represent the session-specific information you desire to retain, with each piece of information separated by some delimiter, such as "||||" or "," or a tab character -- anything that wouldn't ever be part of the information you're trying to retain. The first element of each line could be the full "session path" so that you could easily identify the data that applies to the session you're currently operating on within your script.

You can also save information within the "description" of a saved session itself. This technique is demonstrated in an existing example script: Use Description Field As Script Arguments. This example is found among the many on our Script Examples "sticky" -- the top-most thread in the main Scripting forum.

If you're on Windows, you can also consider storing information in the Windows registry within a location of your choosing (Typically this would be somewhere in HKCU\Software\Your_Specific_Key_Name\...).

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
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 12:51 PM.