Indigo Rose Software
  #1  
Old 08-24-2008
pher pher is offline
Forum Member
 
Join Date: Aug 2008
Posts: 4
I just don't get it

I really like the simplicity of this product in many areas. However, there is a massive disconnect between me and the product in other areas.

For the life of me, I've been unable to figure out how to do some things that seem rather simple. I've reviewed all the video tutorials, and read all that I could find on the forums, but I still haven't found the answer.

So, here I am with what I hope is something really simple that makes me feel extremely foolish.

I want to create an installer that does the following On Post Install, prior to the finish screen:

1. Allow the user to browse to a file on their hard drive (I store this file location as a session variable).

2. I then modify a text file (configuration file) with the value of the path specified in the step above.

That's it.

Any help would be massively appreciated.
Reply With Quote
  #2  
Old 08-24-2008
Ulrich's Avatar
Ulrich Ulrich is offline
Indigo Rose Staff Member
 
Join Date: Apr 2005
Location: Sao Paulo, Brazil
Posts: 823
Please show what you have in On Post Install, because with it it is easier to point out what you are doing wrong.

Ulrich
Reply With Quote
  #3  
Old 08-25-2008
pher pher is offline
Forum Member
 
Join Date: Aug 2008
Posts: 4
That's just it... I've not made much progress in that area.

I've created an Edit Fields screen.

I have the following:

Screen ID: Server Logs
ID: CTRL_EDIT_01
Label: Location of server logs:
Show button: enabled
Session Variable: %EditVar01%

Everything else is default.

I have nothing in the Actions, simply because I don't know what to put there.

Here's what I want:

I want the button '...' at the end of the input box to open a file dialog window which allows the user to browse to a file in their directory.

Upon selecting that file and clicking the 'Next' button, I want to open a settings file in my installation directory and replace a placeholder value with the %EditVar01% value.

On Post Install has the following:
result = Dialog.FileBrowse(true, "Locate Server Log", _DesktopFolder, "Log Files (*.log)|*.log|", "", "log", false, true);

I don't know what to put for Event Variables.

When I run the install, it immediately opens a file dialog box without bringing me to the Server Logs screen. When I select the file, the install shuts down and all windows are closed. I need the file dialog box to only open when the button on the screen is pressed.

Last edited by pher; 08-25-2008 at 07:42 AM.
Reply With Quote
  #4  
Old 08-25-2008
pher pher is offline
Forum Member
 
Join Date: Aug 2008
Posts: 4
Ok, I've managed to get it to not terminate the setup when the file dialog window is closed, however, I still haven't figured out how to bind the button click event to the open file dialog.
Reply With Quote
  #5  
Old 08-25-2008
pher pher is offline
Forum Member
 
Join Date: Aug 2008
Posts: 4
I'm starting to make some progress.

I was able to figure out the eventid for the button press...

So, I have the following code on my 'On Ctrl Message' actions:

Code:
if(e_CtrlID == 121) then

	-- Browse
	result = Dialog.FileBrowse(true, "Locate Server Log", _DesktopFolder, "Log Files (*.log)|*.log|", "", "log", false, true);

	-- Debug - spit out the filename we found to a messagebox
	Dialog.Message("file", result[1], MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

	-- Replace placeholder value with file path
--	local sFileData = TextFile.ReadToString("%AppFolder%\\settings.txt");
--	sFileData = String.Replace(sFileData, "%PlaceHolder%", result[1], true);
--	TextFile.WriteFromString("%AppFolder%\\settings.txt", sFileData, false);
end
I've not been able to figure out how to set the filepath I've now stored in my result to the control on the installer.

Also, I've not tested the replace code...
Reply With Quote
  #6  
Old 08-25-2008
Mark's Avatar
Mark Mark is offline
Indigo Rose Staff Member
 
Join Date: Jun 2000
Location: Indigo Rose Software
Posts: 1,773
Hi pher,

If you want to browse for a file on the Edit Fields screen, what you can do (in general) is enable the first edit field's button and then add the following code to the "On Ctrl Message" event of the Edit Fields screen:

Code:
if ((e_CtrlID == CTRL_BUTTON_01) 
	and (e_MsgID == MSGID_CLICKED)) then
	--The first edit ctrl's button was clicked.
	
	local tbEditProps = DlgEditField.GetProperties(CTRL_EDIT_01);
	if(not tbEditProps) then
		-- The edit field is not accessible or does not exist
		return;
	end
	-- browse for the server log
	result = Dialog.FileBrowse(true, "Locate Server Log", _DesktopFolder, "Log Files (*.log)|*.log|", "", "log", false, true);
	-- if the result if valid then update the edit field
	
	if((result ~= nil) and (result[1] ~= "CANCEL")) then
		--get the first selected file
		tbEditProps.Text = result[1];
		--update the edit field
		DlgEditField.SetProperties(CTRL_EDIT_01, tbEditProps)
	end
end
In general what you are doing is responding to the MSGID_CLICKED event that is sent by the CTRL_BUTTON_01 button control when it is clicked. Then you get the current properties of the edit field, so that you can then update the edit fields properties later on.

Next comes the browse code to browse for the file. Then we check to see if the result is valid. If it is valid we update the Text portion of the edit field's propertied and update the edit field.

Then on the "On Next" event you should be able to write the expanded version of "%EditVar01%" to you settings file.

I hope this helps.
__________________
MSI Factory The Next Generation Intelligent Setup Builder
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



All times are GMT -6. The time now is 09:44 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