Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 12 of 12
  1. #1
    Join Date
    Mar 2005
    Posts
    103

    Huh? Number of runs, variables, etc.

    Hi.

    I would like to know if it is possible to make a session variable, such as %install_folder%, and then have its value be changed bythe users input. I need something like a dialog box that has a folder browser for the install directory, and then, when chosen, will change the variable. I also need a way to keep track of how many times it has been run, because I have a script that requires it to know if it has been run before by checking in the registry for the install directory.

    I know this is a lot to ask, but thank you.

  2. #2
    Join Date
    Jan 2002
    Location
    Nashville TN
    Posts
    328
    This is one easy way,
    input = Dialog.Input("TItle", "prompt", "default display text")
    SessionVar.Set("%install_folder%", input)

    You can also add a second "Select Install Folder" and set its "Store Result in session carable to %install_folder%

    And the %install_folder% can be used on a screen to display the value to the user.

  3. #3
    Join Date
    Mar 2005
    Posts
    103

    Huh?

    Thanks.

    I used that, and made it into:
    Code:
    target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
    if (target_folder ~= "CANCEL") and (target_folder ~= "") then
        error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    		strDestinationFile = "target_folder";
    elseif(error == 0) then
    SessionVar.Set("%install_folder%", target_folder);
    	end
    end
    I have found a way around the "keep track of number of installs' thing, but what I now need is a way for the target directory to also set a regisrty value, and each time it runs, it will read of that value.
    Last edited by rctshine; 03-23-2005 at 03:14 PM.

  4. #4
    Join Date
    May 2000
    Location
    Indigo Rose Software
    Posts
    2,150
    rctshine,

    Here is some code that may help:

    Code:
    RegRead = Registry.GetValue(HKEY_CURRENT_USER, "Software\\My Application", "MyValue", true);
    if RegRead == "" then
    -- first time the installer has been run
    -- now write out the key that you just looked for
    Registry.SetValue(HKEY_CURRENT_USER, "Software\\My Application", "MyValue", "My Data", REG_SZ);
    else
    -- the Install has been run at least once before
    end
    you could also make this a numeric value if you would like to know exactly how many times it has been run.

    Adam Kapilik

  5. #5
    Join Date
    Mar 2005
    Posts
    103

    Huh?

    I meshed all yours together to make one.

    Here is what I put for where to install:
    Code:
    -- Select the directory.
    target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
    if (target_folder ~= "CANCEL") and (target_folder ~= "") then
        error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    		strDestinationFile = "target_folder";
    elseif(error == 0) then
    SessionVar.Set("%install_folder%", target_folder);
    Registry.SetValue(HKEY_LOCAL_MACHINE, "myvalue\\myvalue", "installfolder", "install_folder", REG_SZ);
    	end
    end
    And this went into the startup folder:
    Code:
    --check for install folder
    regcheck = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "myvalue//myvalue");
    		if (regcheck) then
    regval = Registry.GetValue(HKEY_LOCAL_MACHINE, "myvalue\\myvalue", "installfolder", true);
    SessionVar.Set("%install_folder%", regval)
    if (Application.GetLastError() ~= 0) then	
    regcheck = false;
    	end
    end
    Will it work?

  6. #6
    Join Date
    Mar 2005
    Posts
    103

    Huh?

    Can you guys help me?

    With that code, I get the "argument 1 must be of type string" error.

    Here is the complete page:

    Code:
    -- These actions are performed before the screen is shown.
    
    -- Set some variables for the file download...
    -- Put your full URL to the file here...
    strSourceURL = "http://mypage.com/myfile.grf";
    -- Select the directory.
    target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
    if (target_folder ~= "CANCEL") and (target_folder ~= "") then
        error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    		strDestinationFile = "target_folder";
    elseif(error == 0) then
    SessionVar.Set("%install_folder%", target_folder);
    	end
    end
    bIsBinaryFile = true;
    
    -- Set to true is the user presses cancel (see the On Cancel event)
    bCancelled = false;
    
    -- Initialize the progress bar...
    DlgProgressBar.SetRange(CTRL_PROGRESS_BAR_01,0,100);
    DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01,0);
    Last edited by rctshine; 03-23-2005 at 04:36 PM.

  7. #7
    Join Date
    Mar 2005
    Posts
    103
    Hellllppppppp........

  8. #8
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Hi there..this might make the code more 'logical as far as how to go about it

    Code:
    strSourceURL = "http://mypage.com/myfile.grf";
    -- Select the directory.
    target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
    if (target_folder ~= "CANCEL") and (target_folder ~= "") then
    SessionVar.Set("%install_folder%", target_folder);
    error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            bCancelled = true; --trigger 'on cancel '		
    	else
    	strDestinationFile = target_folder;
    	bIsBinaryFile = true;
    	-- Set to true is the user presses cancel (see the On Cancel event)
    	bCancelled = false;
    	-- Initialize the progress bar...
    	DlgProgressBar.SetRange(CTRL_PROGRESS_BAR_01,0,100);
    	DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01,0);	
    	end
    else
    bCancelled = true; --trigger 'on cancel'
    end
    ps line 18 above move the 'end' back in line with the 'if'

    something is wrong with how code is displaying on the forum at the moment.

    HTH
    Last edited by Eagle; 03-23-2005 at 07:52 PM.

  9. #9
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    try this ..

    Code:
    -- Put your full URL to the file here...
    strSourceURL = "http://mypage.com/myfile.grf";
    -- Select the directory.
    target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
    if (target_folder ~= "CANCEL") and (target_folder ~= "") then
    SessionVar.Set("%install_folder%", target_folder);
    error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            bCancelled = true; --cancel the download 		
        else
    	strDestinationFile = target_folder;
    	bIsBinaryFile = true;
    	-- Set to true is the user presses cancel (see the On Cancel event)
    	bCancelled = false;
    	-- Initialize the progress bar...
    	DlgProgressBar.SetRange(CTRL_PROGRESS_BAR_01,0,100);
    	DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01,0);	
        end
    else
    bCancelled = true; --cancel the download
    end
    forum display is fine..(initial formatting was sus)
    Last edited by Eagle; 03-23-2005 at 07:59 PM.

  10. #10
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    another thought..it may be better to set the destination folder
    (folder.browse) on the previous screen's 'on close' event

    that way easier to 'control wether to display the 'download screen' at all,
    if an error or user selects 'cancel at the folder browse action.

    ..you could then select which screen to 'jump to' or 'retry' etc
    Last edited by Eagle; 03-23-2005 at 08:45 PM.

  11. #11
    Join Date
    Mar 2005
    Posts
    103
    Will that solve the "argument 1 must be of type string" error?

  12. #12
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Hi, what I suggest is you save your current project to a new 'test' project

    using 'saveas'

    then try out the code suggestions with your saved Test project
    and see where you can fit them in, changes, whatever suits you.

    these are just suggestions..it is up to you to from then on ,
    however from the code you provided, that issue should be gone.

    get back if still problems getting what you want to work.

Similar Threads

  1. Variables in message dialogs now broken?
    By Tek in forum Setup Factory 7.0
    Replies: 2
    Last Post: 03-14-2005, 02:09 AM
  2. Help passing screen variables
    By swilk in forum Setup Factory 7.0
    Replies: 2
    Last Post: 12-06-2004, 11:07 AM
  3. Converting . over to _ in variables
    By Marker0077 in forum Setup Factory 6.0
    Replies: 7
    Last Post: 06-04-2003, 02:30 PM
  4. HOWTO: Limit the Number of Times an Install can be Run
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-17-2002, 02:58 PM
  5. INFO: Setting Environment Variables
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-10-2002, 12:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts