User Tag List

Results 1 to 8 of 8

Thread: Install Creator: Run a file BEFORE starting installation

  1. #1
    No Products Registered

    Join Date
    Oct 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Install Creator: Run a file BEFORE starting installation

    Is it possibile to look for a file (.EXE) in a folder and launch it if exists, before starting installation or something like this?
    This file is requested for checking eligibility to update software

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,455
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    There is an option for that in the Options tab in the Pro version. Try it and see if it works for you.

  3. #3
    No Products Registered

    Join Date
    Oct 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Yves View Post
    There is an option for that in the Options tab in the Pro version. Try it and see if it works for you.
    no, in there is not the possibility to select Run BEFORE Setup.

  4. #4
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,455
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Ah, sorry I misunderstood what you mean... You are right, that's not possible.

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using Install Creator alone, you cannot run the check prior to the actual setup running. However, like Yves says, in the Pro version, you can put in a check on the Options tab where it says "Do not start the installer if..." "...the following file is not installed".
    If you set that option and the specified file does not exist, the files will not be installed, and an error message will pop up stating "Cannot install this program, a required file is missing." (you can modify this message to say "You don't have a current version of this software installed", or something), and won't allow the installer to get any further.

    An alternative could be to use AutoIt, or similar, to create a "wrapper" for the setup file that does a FileExists() check and to FileInstall() and Run() the actual setup file if the check passes. You could also check is certain registry keys exist, or do file version checks, etc.
    The only problem that I can see with this method, is if someone legitimately runs it, and the setup is extracted using FileInstall(), then they can simply copy the extracted setup file and release that, thus bypassing any of your checks (unless you also set the Install Creator Pro option mentioned above for the actual setup file itself).

    If the alternate method, mentioned above, is something that you'd like, then PM me and I can make an example AutoIt script for you.

  6. #6
    No Products Registered

    Join Date
    Oct 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, thank you. A script is very useful to me.
    Thanks.

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    Here's an example script. It looks really long, but it's actually only 13 lines long. I've just spaced the commands, and commented the crud out of it, lol.

    Copy it, paste into the autoit editor, save it as "script.au3" (or whatever) and modify it to suit your program/game.

    When it's pasted into the autoit editor, all the commands will automatically get color-coded to make it easier to read.

    You can download the free AutoIt editor/compiler here: http://www.autoitscript.com/site/autoit/downloads/ (it's the first download in the table)

    Code:
    ;Set the temp setup file path here
    $TempFile = @TempDir & "\GameSetup.exe"
    
    ;Read the game's installation path from the registry
    ;To read a 64-bit registry entry, replace HKLM with HKLM64 (or HKCU with HKCU64, etc.)
    $InstallPath = RegRead("HKLM\SOFTWARE\My Company\My Game", "InstallPath")
    
    If Not FileExists($InstallPath & "\Game.exe") Then ;You can also replace this variable with a static path, such as @ProgramFilesDir & "\My Game\Game.exe"
        ;If the file doesn't exist, display an error message instead of extracting/running the setup file
        MsgBox(16, "Upgrade Not Available", "You don't currently have a version of the game installed." & @CRLF & "Setup will not continue") ;Note: @CRLF = newline
    Else
        ;If the file DOES exist, run some exe and wait for it to close...
        RunWait($InstallPath & "\the exe you want to run before setup.exe")
    
        ;...then display a progress bar to tell the user that the installation files are being extracted...
        ProgressOn("Setup", "Please Wait", "Extracting Setup Files...")
    
        ;...extract the setup file (located in the same directory as this script) into the temp path stated at the top of the script
        ;(This file will be compressed into the exe that this script gets compiled into, so you just need to distribute the 1 exe (this script))
        FileInstall(".\Setup.exe", $TempFile, 1)
    
        ;After the file is extracted, close the progress bar
        ProgressOff()
    
        ;Run the extracted setup file, and wait for it to close
        RunWait($TempFile)
    
        ;Once it's closed (finished), delete the setup file out of the temp directory
        FileDelete($TempFile)
    EndIf
    
    Exit
    
    ;The rest here are notes, not part of the above script.
    
    
    
    ;To get the return code of an exe, assign RunWait() to a variable. E.g.
    $ReturnCode = RunWait($InstallPath & "\some.exe")
    ;Will run $InstallPath & "\some.exe", wait for it to finish, and then store its return code into the $ReturnCode variable.
    ;This is handy for if you have an exe to do license validation, etc. and have it return a certain code for valid/invalid.
    ;You can then do something like the following:
    If $ReturnCode = 1 Then
        ;Licence valid
    Else
        ;Licence invalid
    EndIf
    The problem that I can see with this though, is that while the setup file is running, the user can go in to the temp directory, copy the extracted setup file and paste it elsewhere. Then if they want to run the setup file later WITHOUT doing any of the checks, they just need to run the one that they copied out or the temp directory. A lot of Popcap games use the above script method, and have/had this vulnerability.
    If it's being used just to see if a file exists or not, then it will be fine, but it's not very secure if you want to use it for license validation, etc.

    One way to secure the above vulnerability a little better, would be to ALSO set the option in Install Creator Pro that Yves and I mentioned in previous posts in this thread. That way, even if they copy the file out and run that instead, it STILL won't install because the certain file doesn't exist, and the installer won't continue. Don't rely of the wrapper alone.

  8. #8
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Mar 2011
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Frank, it's been a week. Did the wrapper do what you wanted, or do you need more help?

Similar Threads

  1. Install Creator PRO: Change a File during Install
    By Scanjet in forum Install Creator and Patch Maker
    Replies: 5
    Last Post: 3rd December 2010, 04:01 PM
  2. Install Creator - Create a file
    By madmac in forum Install Creator and Patch Maker
    Replies: 4
    Last Post: 28th March 2010, 09:16 PM
  3. Install Creator Silent Installation?
    By sidefx88 in forum Install Creator and Patch Maker
    Replies: 5
    Last Post: 4th April 2009, 09:09 PM
  4. Guest Login Installation with Install Creator Pro
    By TJM in forum Install Creator and Patch Maker
    Replies: 1
    Last Post: 14th October 2008, 06:14 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
  •