ReRun 
Version 1.0
by Brother Gabriel-Marie
September 12, 2010
You are free to use and abuse this program for any reason at all, but you use it at your own risk and I cannot be held liable for any damages or loss of data involved in its use.  Feel free to contact me if you have questions, need help, or have suggestsions or requests.  brgabriel@sspx.org

Tested only on Windows XP.
Written in BCX.

Contents:
    1.  Description
    2.  Variables
    3.  ReRun Mode
    4.  App Mode
    5.  Basic ini file
    6.  Default ini file
    7.  History

--------1. Description------------------------------------------

Sometimes you need to launch a certain program with certain parameters, but you don't have any way to specify the parameters!  This may be the case with certain toolbars for some programs.  ReRun is a workaround to this where you specify the parameters within the actual filename of an executable.   It is similar to writing a whole bunch of batch files, but with ReRun, you won't see the console box, and you can specify all the parameters in a single file.  BE SURE THAT A COPY OF ReRun.ini IS IN THE SAME FOLDER WITH ANY ReRun PROGRAMS!

ReRun has two methods of operation: ReRun Mode and App Mode.  ReRun mode is simpler and faster, but App Mode offers more versitality.  In the ini file that comes with ReRun, it has a few examples already inside; see section 4 for a default, blank ini file.

-------2. Variables-------------------------------------------
Variables:
These variables have no trailing backslashes, so you will need to supply your own.
%drive%     = drive letter of running instance of ReRun
%app%      = full path to folder containing instance of ReRun

Note that if you want to use a portable drive letter, in your ini file, substitute "%drive%" (without quotes) for your drive letter.  This works anywhere in the ini file.  Likewise, %app% will be substituted with the path to your ReRun program.
Example:  G:\somefolder\someapp.exe  =  %drive%\somefolder\someapp.exe
Example:  G:\somefolder\ReRun.ini   = %app%\ReRun.ini

----------3. ReRun Mode----------------------------------------
In this mode, you simply rename ReRun.exe to anything you like.  Then, in the ini file, under the "[ReRun]" section, add that name as a key.  Make sure that whatever you renamed ReRun.exe to, that you also put that as a key in the ini file (without the .exe on the end).  This will look up ReRun's name in ReRun.ini file and RUN that value.  

For example, if you rename ReRun.exe to example.exe, it will run notepad and open a particular file for you just as if you had typed the command into the RUN box.
This is the ini contents for example.exe:

    [ReRun]
    example = notepad.exe

For this one, the full file path is required:
    [ReRun]
    np = C:\Program Files\ReRun\ReadMe.txt

If you rename ReRun.exe to George.exe, and run George, it will open a web page.  If you use Powerpro, you can run a powerpro function from a script by renaming ReRun.exe to pp.exe.  If you rename ReRun.exe to example1.exe, it will open the ReadMe.txt file in your default text editor.
    [ReRun]
    example = rrun:ReRun.ini
    example1=open: ReadMe.txt
    example2 = C:\Program Files\notepad2\Notepad2.exe C:\Program Files\ReRun\ReRun.ini
    George = http://www.sspxusa.org/goodies
    pp = C:\Program Files\PowerPro\powerpro.exe .myPowerProScript@myPPfunction()


Using "rrun:" and "open:"
If the default method of execution does not work, try putting "rrun:" or "open:" in front of the line (without the quotes, and WITH the colon - note that "rrun:" does have two r's).  This will allow you to run or open files in the same folder as ReRun without having to specify the full path and without specifying a program.  It will also allow the use of mailto calls and other sundry commands.  The use of rrun: and open: is only of service in ReRun Mode.

----------4. App Mode----------------------------------------
In App Mode, you can specify certain options for groups of parameters, such as window mode and application path.

In the following example, We use NP as our program's name AND put it in the ini file as a section heading.  Then, in the program's name, we put our parameter in parentheses AND put that parameter in the ini file as a key under our program's name.  Make sure it all matches!  This will allow us to use the same settings each time with different parameters.  With parameters in the ReRun name, the best thing to do is to use very short ones.  The naming scheme does tolerate spaces, by the way.

application     --> this is what executable you want to run
mode            --> show the application window in a particular way
xxx               --> this is your parameter which you set in both ReRun's name and in the ini file.
  
You should copy and rename ReRun.exe three times until you have these in a folder:  
    NP(test).exe
    NP(test1).exe
    NP(test2).exe

    [ReRun]
    example = notepad.exe %app%\ReRun.ini
    [NP]
    mode = 1
    application = C:\Program Files\notepad2\Notepad2.exe
    test = %app%\ReadMe.txt
    test1 = %app%\ReRun.ini
    test2 = C:\somefolder\somefolder\somefile.extension

Just FYI, if you leave "application" blank, ReRun will try to open your parameter with its default program.

Also, if you specify a parameter in ReRun's name but leave it blank or missing in the ini file, it will simply run the application in "application."  If both "application" AND the parameter are blank, usually on my computer for some reason it opens ReRun's folder in Windows Explorer; I don't know what it will do on yours.

The "mode" parameter allows some control over the window of the application being run.  Here are the possible parameters:  (anything else will default to 1), so normally you can leave it out.
    0       Hide Window
    1       Show Normally (default)
    2       Show Minimized
    3       Show Maximized


With this example INI, you should have a set of ReRun.exe's renamed to the following:
    George.exe
    Bob(a).exe
    Bob(b).exe
    Bob(c).exe
    George(100).exe
    PP(myfunc).exe

And here is the contents of the INI file:
    [ReRun]
    George = notepad.exe %app%\ReRun.ini
    [Bob]
    mode = 1
    application = C:\Program Files\notepad2\Notepad2.exe
    a = %app%\ReadMe.txt
    b = %app%\ReRun.ini
    c = C:\somefolder\somefolder\somefile.extension
    [George]
    mode = 1
    application = C:\Program Files\notepad2\Notepad2.exe
    100 = %app%\ReadMe.txt
    101=%drive%\somefolder\somefolder\sometextfile.txt
    [PP]
    application = C:\Program Files\PowerPro\powerpro.exe
    myfunc = .myPPscript@somefunction("PPparameters")

Here is how to open webpages in your non-default browser on your portable drive - if you use the %drive% variable, the drive letter will change automatically; just rename ReRun.exe to webby(goodies).exe (you can use any name, not just webby):
    [ReRun]
    ReRun = rrun:ReadMe.txt
    [webby]
    application = %drive%\GreenBrowser\GreenBrowser.exe
    goodies = http://www.sspxusa.org/goodies




---------5. Basic ini file-----------------------------------------
;Note that you may omit "mode"
[ReRun]
ReRun = open:ReadMe.txt

Here is a basic section for AppMode:
[myApp]
mode=1
application=notepad.exe
myparam=C:\somefolder\sometextfile.txt


-----6. Default ini file---------------------------------------------
[ReRun]
;will run whatever the app is named.  ReRun.exe will simply run notepad in this case.
ReRun = notepad.exe 
;If you rename ReRun.exe to PPtest.exe, it will run this commandline:
PPtest = C:\Program Files\PowerPro\powerpro.exe .myPowerProScript@myPPfunction()
;If you rename ReRun.exe to info.exe, it will open the ReadMe file in the folder with ReRun
info= %app%\ReadMe.txt
launchwebpage=http://www.sspxusa.org/goodies
;If you want to run a file in the same folder as ReRun but don't want to specify the full path, put "rrun:" or "open:" in the parameter line (it doesn't matter if there is a space after it).
test=open: ReadMe.txt
test1=notepad.exe %app%\ReadMe.txt
[PP]
;requires ReRun to be renamed: PP(myfunc).exe
mode=0
application=C:\Program Files\PowerPro\powerpro.exe
myfunc = .myPowerProScript@myPPfunction()
[NP]
;Uses Notepad2 - make sure the file paths are correct.
mode = 1
application = C:\Program Files\notepad2\Notepad2.exe
test = %app%\ReadMe.txt
test1 = C:\Windows\somefolder\somefile.txt
test2=
[webby]
;Open Webpages in GreenBrowser on your usb drive. It will change the drive letter automatically.
;Usage:  copy ReRun.exe and rename it to webby(goodies).exe
application = %drive%\GreenBrowser\GreenBrowser.exe
goodies = http://www.sspxusa.org/goodies
[XnView]
application= C:\Program Files\XnView\xnview.exe
;If you want to put a button in XnView's Browser toolbar, create an instance of ReRun called "XnView(mypics)".  For some reason, you have to put two sets of double quotes for it to work with XnView (version 1.97.7)
mypics =""C:\somefolder\somefolder""


------7.  History--------------------------------------------
version 1.1     : September 14, 2010: added variables for %drive% and %app%
version 1.0     : September 13, 2010: initial release









