Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73

    Huh? INI file to control my app?

    Hi I am really not sure how to explain this, but I will try my best.

    I am making a new setup program, and this will setup various programs, drivers & customisations.

    The part I am stuck at is there is a page with 2 buttons (1 labeled T30 & the other T41), now when someone clicks on the relevant button, I need my program to store the users choice in a .ini file, as in the code below:
    Code:
    INIFile.SetValue(_WindowsFolder.."\\NewInstall.ini", "System Information", "Laptop Make", "IBM Thinkpad T41");
    Now this is the tricky bit, I have a button on the next page called "Install Drivers" and what I need is that it will install the relevant set of drivers for the chosen button above (either T30 or T41) as the zip files are labeled "T30 Drivers" and "T41 Drivers" so is it at all possible that if I clicked on the T30 button it would store this choice in the ini file, and then when I click on the drivers button for it to unzip the relevant zip?

    Thanks all!

  2. #2
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    PHP Code:
    if (INIFile.GetValue(_WindowsFolder.."\\NewInstall.ini""System Information""Laptop Make",) == "IBM Thinkpad T41"then
    -- The laptop is a IBM Thinkpad T41
    else
    -- 
    The laptop is a IBM Thinkpad T30
    end 

  3. #3
    Join Date
    Mar 2006
    Posts
    61
    Now this is just quick out of my head just as an example. You can expand on this and use the File.Install function to install the files rather then extracting them directly to the location you want. You'll have to extract the files to a temp location, then install them from that location. That is of course if you want them to be installed like that? Also, don't forget to clean up after yourself, any files you put on the users machine that are not absolutely required to be there should be removed, always.

    Just a note. I use local variables when ever possible. They are faster, and they are cleared right after they are no longer used. Global variables in Lua are not cleared until a garbagecollect is done, they are also slower. Unless you absolutely need all your variables to be global, remember to put 'local' in front of them. You will notice the difference in speed, and in memory usage. And it is good programming practice.

    So with that, the example:
    Code:
    Button 1 ; T41
    	INIFile.SetValue(_WindowsFolder.."\\NewInstall.ini", "System Information", "Laptop Make", "IBM Thinkpad T41");
    	
    Button 2; T30
    	INIFile.SetValue(_WindowsFolder.."\\NewInstall.ini", "System Information", "Laptop Make", "IBM Thinkpad T30");
    	
    Button 3; Drivers Install
    	local usrModel = INIFile.GetValue(_WindowsFolder.."\\NewInstall.ini", "System Information", "Laptop Make");
    	if (usrModel ~= "") then
    		-- Install drivers. This way will only work if the drivers .zip
    		-- archives are named the same as what you store in the ini.
    		local sDrvFile = _SourceFolder.."\\"..usrModel..".zip";
    		local sExtractLocation = "where ever you want them extracted too";
    		-- Extract to location
    		Zip.Extract(sDrvFile, {"*.*"}, sExtractLocation, true, false, "", ZIP_OVERWRITE_NEWER, nil);
    		local err = Application.GetLastError();
    		if (err ~= 0) then
    			Dialog.Message("Error", _tblErrorMessages[err], MB_OK, MB_ICONEXCLAMATION);
    			return -1; --return false, return what ever to stop any further code execution.
    		end
    	end

  4. #4
    Join Date
    Sep 2007
    Location
    UK
    Posts
    73
    Thanks ever so much for your replies and you *REALLY* need to get more sleep if your up here till all hours hehe

    @ Bags: thanks for your opening lines, but this project is for just my household PC's, and I have set the drivers zip to extract to d:\drivers (second partition on laptop hard drive, I put all the data like programs, my music, pics, email & MSN folders on a second partition, as if the main boot part fails, I still have the stuff safe that is important to me, but also do a full drive backup once a week & made a lil network backup util so all my docs & stuff get copied over to my server hd far safe keeping!)

    I shall try out the code later and post back with what I find

    Thanks once again you 2

  5. #5
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by TheProg View Post
    Thanks ever so much for your replies and you *REALLY* need to get more sleep if your up here till all hours hehe

    @ Bags: thanks for your opening lines, but this project is for just my household PC's, and I have set the drivers zip to extract to d:\drivers (second partition on laptop hard drive, I put all the data like programs, my music, pics, email & MSN folders on a second partition, as if the main boot part fails, I still have the stuff safe that is important to me, but also do a full drive backup once a week & made a lil network backup util so all my docs & stuff get copied over to my server hd far safe keeping!)

    I shall try out the code later and post back with what I find

    Thanks once again you 2
    just to state something here doing that to a drive is really not a good idea
    its alwasys better to have 2 drives to do that kinda thing with as the drives will last longer.

    but i guess we all do it at one point i had mine partioned a thou times

Similar Threads

  1. How can i save a ini file does not exists ?
    By Kier in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 12-10-2007, 06:44 AM
  2. ini file problems.. help
    By AciDFuRY in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 02-26-2006, 06:46 PM
  3. Tables And Ini File
    By lanfz in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 05-19-2004, 01:44 PM
  4. Audio Tracks Project
    By Michael in forum AutoPlay Media Studio 5.0
    Replies: 7
    Last Post: 03-18-2004, 10:58 PM
  5. A preference for including an external INI file
    By TimCarroll in forum Setup Factory 6.0
    Replies: 1
    Last Post: 07-22-2002, 10:38 AM

Posting Permissions

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