Indigo Rose Software
  #1  
Old 04-28-2008
Adam's Avatar
Adam Adam is offline
Indigo Rose Staff Member
 
Join Date: May 2000
Location: Indigo Rose Software
Posts: 2,154
How do Session Variables work?

Question
How do Session Variables work?

Answer
Session Variables Explained

Session variables are used in Setup Factory 7.0 to hold various forms of data that can then be displayed to the user through screens, and/or used in script. For example, %AppFolder% is a Session Variable that has many uses in Setup Factory.

When the data contained in a Session variable must be displayed to the user through a screen, the session variable can be referenced 'as is'. For example:
Code:
%AppFolder%\\myfile.txt
However, to use a Session variable within LUA script, the data from the Session variable must first be expanded. Setup Factory 7.0 ships with a built-in action to accomplish this task: SessionVar.Expand().

For example:
Code:
File.Open(%AppFolder%\\file.txt, "", SW_SHOWNORMAL);
The above script would fail, even if file.txt existed in the location referenced in the Session variable %AppFolder%. This is because the data from the variable was not expanded. The proper script is as follows:

Code:
-- This action saves the value of a Session variable into a Lua variable.
AppFolder_Lua = SessionVar.Expand("%AppFolder%");
-- You can then use this Lua variable to reference the file.
File.Open(AppFolder_Lua.."\\file.txt", "", SW_SHOWNORMAL);
Or alternatively, the SessionVar.Expand() action can be used:
Code:
File.Open(SessionVar.Expand("%AppFolder%").."\\file.txt","",SW_SHOWNORMAL);
When data must be stored in a Session variable, the built-in action SessionVar.Set must be used:

Code:
SessionVar.Set("%NewVariable%", "I am a value!!");
For more information please see the following topics in the Setup Factory help file:

Program Reference | Variables | Session Variables

Last edited by Adam; 04-29-2008 at 01:12 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
session variables ultraz57 Setup Factory 7.0 Discussion 3 06-08-2007 11:54 AM
Sharing values across projects (session variables) Shide AutoPlay Media Studio 6.0 3 01-19-2007 10:06 PM
Session Variables AlanNicoll Setup Factory 7.0 Discussion 1 01-11-2007 01:31 PM
Session variables maddrt01 Setup Factory 7.0 Discussion 4 06-12-2005 06:41 AM
session variables in action strings tkilshaw Setup Factory 7.0 Discussion 3 04-21-2005 01:58 PM


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


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software