- first draft -
Home of SalaPortable
============================
I playing around to make Apps portable
for to carring it around on my USB-Stick.
First i try to make my favorite file manger portable.
I use
<Servant Salamander 2.5> as beta 11.
I use an AutoIt script which must be in the same folder as SALAMAND.exe
and create then an environment variable which is set to the current working dir.
(The working dir is that path\folder where the SalaPortable.exe exist)
In the settings for the user menu in Sala i use the special token $[xxx]
for to refer to this environment variable i create with my AutoIt script.
i.e. f.ex. $[SalaPath]\MyTools\CSDiff5\CSDiff.exe
for to start this exe from e.g. X:\USB-Drive\Tools\Sala2.5BETA11\Plugin\MyTools\CSDiff5\
where the part "X:\USB-Drive\Tools\Sala2.5BETA11" is flexible .... this is the
current working dir which is stored in the env var SalaPath.
I have choosen the env name "SalaPath"... you can modify this in the script if you prefer.
This environment var "SalaPath" is only visible/accessible inside the AutoIt script
so i start the SALAMAND.exe from this script too.
There are weak points:
- This work around isn't very comfortable, but it should work.
- If Salamander is not startet from this script he tells about missing "SalaPath" for each plugin
- As we import the settings on an foreign PC with "config.reg".... we replace the existing settings (if there any, you may wish to save this first )
/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\:/\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have testet this behaviour on XP SP2 without admin right.
Please test this script/exe if it works for you too.
Please use it on your own risk!If you have questions let me know by an reply on this thread.
Here is the How to:# Save your current settings* go to "Options|| Export Configuration..."
* click [Yes] to save your current config first
* store this 'Config_.reg' as e.g. "My current Config_.reg"
(Salamander will import this config at start, if you rename this file later to 'Config.reg')
# modify the path to your tools* go to "Options||Configuration...||User menu"
* modify your paths
e.g. from "C:\Program Files\Servant Salamander 2.5 beta 11\Plugins\Tools\MyApp\app.exe"
to "$[SalaPath]\Plugins\Tools\MyApp\app.exe"
"C:\Program Files\Servant Salamander 2.5 beta 11" is in this case the current working dir
which will be covered later by $[SalaPath].
You will see sooner or later that this $[SalaPath] is not found right now.
Remember, this env var is only valid later, if you have execute the script (respectively the compiled exe)
# Save your modifyed settings* go to "Options|| Export Configuration..."
* click [Yes] to save your current config first
* store this 'Config_.reg' as e.g. "My portable Config_.reg"
# copy to USB* copy this compiled AutoIt script to your Salamander folder
* copy the hole Salamander folder to an USB-Stick (or what else e.g. CD-RW, network drive, goggle mail...)
* rename "My portable Config_.reg" to "Config.reg" (Salamander will import this settings on start)
# start portable Salamander* don't start SALAMAND.exe but SalaPortable.exe
- SalaPortable.exe will create an environment variable called "SalaPath" and starts SALAMAND.exe.
- THIS SALAMAND.exe will now recognize this env var "SalaPath" and can this way execute your tools.
=================================================
Here is the AutoIt script i use:
SalaPortable.au3
$App = "SALAMAND.exe" ; the app name
$EnvValue = "SalaPath" ; the name of the environment variable for use as $[xxx]
; -----------------------------------------------------------------
If FileExists(@WorkingDir & chr(92) & $App) Then
EnvSet ($EnvValue , @WorkingDir)
;RUN(chr(34) & @WorkingDir & chr(92) & $App & chr(34)) ; is " " really needed?
RUN(@WorkingDir & chr(92) & $App)
Else
MsgBox(0, "DC-MakePortable Error", _
"Sorry. Unable to find the file " & $RunCmd & " ." & @CRLF & @CRLF _
& "This MakePortable.exe MUST be in the same folder as " & $App & "!" & @CRLF _
& "Then you get an environment variable with the name " & chr(34) & $EnvValue & chr(34) & ", wich you" & @CRLF _
& "could us as " & chr(36) & "[" & $EnvValue & "] for " & $App & " for to execute tools with relative paths." & @CRLF & @CRLF _
& "This is open source, enjoy. Stefan" & @CRLF _
& "For further info's or question's visit us at
www.DonationCoder.com")
Exit
EndIf