Portable Altap Salamander

Support for developers of new plugins, third-party plugin announcements and discussions.
Eva Eden~

Portable Altap Salamander

Post by Eva Eden~ » 13 Feb 2009, 14:57

Hi there,

install AS on your USB drive and use "StartPortable.bat". That's all! Possible other AS installations with other configurations will not be touched!

"NoSpy.zip" is a bonbon for wiping unloved Win protocols, data etc.
Attachments
StartPortable.zip
StartPortable.bat
(378 Bytes) Downloaded 1013 times
NoSpy.zip
NS.bat with helper files
(228.32 KiB) Downloaded 819 times

User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 16 Sep 2009, 17:46

My modified version:
PORTSAL.CMD

Code: Select all

@echo off
Title Portable Salamander
Color 1F
if not exist portsal.reg goto :noportsal
if not exist salamand.exe goto :noportsal

:begin
if "%1" neq "" goto %1
start/min cmd /c "%~nx0 hide >nul"
goto:eof

:hide
reg export HKCU\Software\Altap %tmp%\..\SP
set el=%errorlevel%
if %el%==0 reg delete HKCU\Software\Altap /f
reg import "portsal.reg"
salamand.exe
reg delete HKCU\Software\Altap /f
if %el%==1 exit /b
reg import %tmp%\..\SP
call >%tmp%\..\SP
del %tmp%\..\SP
goto:eof

:noportsal
cls
echo.
echo.
echo              	!!!   REQUIRED FILES MISSING   !!!
echo.
echo    Two files are needed for Altap Salamander Portable Launcher
echo    to operate.  One or both are not found.
echo.
echo    1) PORTSAL.REG  - Configuration file which contains your settings
echo                      You can rename your config_.reg to portsal.reg
echo    2) SALAMAND.EXE - Executable application file
echo.
echo    Please verify that these files exist and restart the Portable Launcher
echo.
echo.
echo.
echo.
echo    Press any key to exit.
pause > nul
goto:eof

User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 24 Oct 2009, 17:24

--- bump

I shot myself in the foot by accidentally launching 2 versions and lost my previous settings. I have modified the launcher and it will now abort if the registry file exists.

PORTSAL.CMD

Code: Select all

@echo off
Title Portable Salamander
Color F5
if exist %tmp%\..\SP goto :abort
if not exist portsal.reg goto :noportsal
if not exist salamand.exe goto :noportsal

:begin
if "%1" neq "" goto %1
start/min cmd /c "%~nx0 hide >nul"
goto:eof

:hide
reg export HKCU\Software\Altap %tmp%\..\SP
set el=%errorlevel%
if %el%==0 reg delete HKCU\Software\Altap /f
reg import "portsal.reg"
salamand.exe
reg delete HKCU\Software\Altap /f
if %el%==1 exit /b
reg import %tmp%\..\SP
call >%tmp%\..\SP
del %tmp%\..\SP
goto:eof

:abort
cls
echo.
echo.
echo              	!!!   PORTABLE SALAMANDER ALREADY LAUNCHED   !!!
echo.
echo.    
echo    Registry keys for Altap Salamader are found in %tmp%.
echo.
echo    1) PORTABLE SALAMADER is currently launched
echo                    OR
echo    2) Previous session registry was not properly imported
echo.
echo    Please verify that Altap Salamander launches properly
echo    and then restart the Portable Salamander Launcher.
echo.
echo    Registry file is: %tmp%\..\SP
echo.
echo.
echo.
echo.
echo    Press any key to exit.
pause > nul
goto:eof

:noportsal
cls
echo.
echo.
echo              	!!!   REQUIRED FILES MISSING   !!!
echo.
echo    Two files are needed for Altap Salamander Portable Launcher
echo    to operate.  One or both are not found.
echo.
echo    1) PORTSAL.REG  - Configuration file which contains your settings
echo                      You can rename your config_.reg to portsal.reg
echo    2) SALAMAND.EXE - Executable application file
echo.
echo    Please verify that these files exist and restart the Portable Launcher
echo.
echo.
echo.
echo.
echo    Press any key to exit.
pause > nul
goto:eof

User avatar
Georgd
Posts: 98
Joined: 24 Jul 2006, 17:13

Re: Portable Altap Salamander

Post by Georgd » 03 Dec 2009, 20:19

This is a really nice idea :) and very useful. I've worked through the code and made some changes that I wanna share with you; mainly it's improvements in avoiding and handling of errors. There are 2 TODOs that you might want to take care of :) And if you dislike to get status commands, be them pure information or errors, remove line 27 goto hide

Code: Select all

@echo off
rem Portable Salamander Launcher - allows portable use of Salamander
rem Source, discussion etc at http://forum.altap.cz/viewtopic.php?f=14&t=3084

rem Relative path to portable salamander directory (where portsal.reg and salamand.exe are). Do not add tailing \
set SalamanderPortableDir=.\PortableApps\SalamanderPortable

rem Settings, checks etc.
set RegBackupFile="%tmp%\SalamanderPortableRegBackup.reg"
if exist %RegBackupFile% goto :abort
if not exist "%SalamanderPortableDir%\portsal.reg" goto :noportsal
if not exist "%SalamanderPortableDir%\salamand.exe" goto :noportsal

:begin
rem Tell user what the window is good for
Title Portable Salamander Launcher - do not close this window!
echo.
echo Portable Salamander Launcher - do not close this window!
echo.
echo.
echo.
rem Hint: Nice to test some code blocks. 
if "%1" neq "" goto %1
rem Start minimized command shell that only executes the command and exits afterwards.
rem TODO explain what it does, make errors in :hide visible and then remove godo hide
rem      %~nx0 shall be the file name and extension
goto hide
start /min cmd /c "%~nx0 hide >nul"
goto:eof

:hide
rem Save current settings to temporary reg file. Handle possible error!
echo If Salamander configuration exists, I'll try to save to temporary file...
reg export HKCU\Software\Altap %RegBackupFile%
set el1=%errorlevel%
if %el1%==1 Color 0E
if %el1%==1 echo. 
if %el1%==1 echo If the error is just that the registry key was not found, and Salamander is
if %el1%==1 echo not installed on this computer, everything is OK and you can continue by 
if %el1%==1 echo pressing any key. 
if %el1%==1 echo Elsewise press CTRL+C to cancel further actions.
if %el1%==1 pause >nul
if %el1%==1 Color 07

rem If everything is fine, delete current settings, load own / portable settings and start with them
if %el1%==0 reg delete HKCU\Software\Altap /f
reg import "%SalamanderPortableDir%\portsal.reg"
echo Starting Salamander...
"%SalamanderPortableDir%\salamand.exe"

rem After closing portable Salamander, revert to saved settings and remove temporary reg file
reg delete HKCU\Software\Altap /f
set el2=%errorlevel%
if %el2%==1 Color 0E
if %el2%==1 echo. 
if %el2%==1 echo Error occoured. If it is severe, abort batch by pressing CTRL+C.
if %el2%==1 pause >nul
if %el2%==1 Color 07
rem Only import etc. if something was exported to avoid false error message
if %el1%==0 reg import %RegBackupFile%
rem TODO I have no idea what that shall be good for - maybe you can explain??
rem call >%RegBackupFile%
if %el1%==0 del %RegBackupFile%
goto:eof

:abort
echo.
echo.
echo                 !!!   PORTABLE SALAMANDER ALREADY LAUNCHED   !!!
echo.
echo.   
echo    Saved registry keys for Altap Salamader are found.
echo.
echo    1) PORTABLE SALAMADER is currently launched
echo                    OR
echo    2) Previous session registry was not properly imported
echo.
echo    Please verify that Altap Salamander launches properly
echo    and then restart the Portable Salamander Launcher.
echo.
echo    Registry file with saved local settings is
echo      %RegBackupFile%
echo.
echo.
echo.
echo    Press any key to exit.
pause > nul
goto:eof

:noportsal
echo.
echo.
echo                 !!!   REQUIRED FILES MISSING   !!!
echo.
echo    Two files are needed for Altap Salamander Portable Launcher
echo    to operate.  One or both are not found.
echo.
echo    1) PORTSAL.REG  - Configuration file which contains your settings
echo                      You can rename your config_.reg to portsal.reg
echo    2) SALAMAND.EXE - Executable application file
echo.
echo    Please verify that these files exist in directory
echo      %SalamanderPortableDir%
echo    (relative path from this file, can be changed in this file) 
echo    and restart the Portable Launcher.
echo.
echo.
echo.
echo.
echo    Press any key to exit.
pause > nul
goto:eof
Hint: I changed the color and title prefix in Configuration-MainWindow, and the colors for items in panel & operation progress & panel caption in Configuration-Colors, so it's easy to distinguish prtable and main installed Salamander. Moreover, I want np++ of PortableApps for editing files, so in editors I used the command $(SalDir)\..\Notepad++Portable\Notepad++Portable.exe
Using Salamander since v 1.52

User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 03 Dec 2009, 20:39

I think if we work on this it can get better and better. I know Jan at one point said that Salamander would run from an INI file, of course that would be portable. But this will keep us going until we get a true portable. One thing I like about it is that it can be configured to your liking and the reg file exported and used on any other system without a fear of leaving traces or alterations behind.

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Portable Altap Salamander

Post by Jan Rysavy » 03 Dec 2009, 20:55

vld wrote:I know Jan at one point said that Salamander would run from an INI file, of course that would be portable.
Yes, we are step closer with Altap Salamander 2.53 beta 1 (Preview Build 38)
+ Import configuration from file to registry and export configuration from registry
  to file are handled by our own rutines (thanks to Jan Patera's RegLib library).
  It solves problem with escalation required by formerly used regedit.exe on Vista
  and Windows 7. Moreover also user without admin rights can import/export
  configuration now.
With Jan's library we are able to do direct Salamander <-> REG file transfer without the Registry step. What we need to do next is change Salamander core to use his interface instead of Windows Registry API. It should be task for a few weeks.

But we are not there yet and your script is really appreciated.

xm
Posts: 67
Joined: 11 Dec 2007, 11:11

Re: Portable Altap Salamander

Post by xm » 04 Dec 2009, 11:49

Now, that's some good news, thanks!
Cann't wait for the truly portable Salamander :-)

User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 04 Dec 2009, 16:01

Jan...a request for you guys as I'm sure you can do it better then us. Until you officially come out with the Salamander working from INI, how about a Portable Launcher based on scripts above? This way all a user has to do is install Salamander and if they want to carry it with them, all they do is copy the folder and use the Launcher to execute the EXE. Just a thought.

User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 05 Dec 2009, 03:18

Jan...question for you. When I copy the files and run them on a HDD, when I try to delete them I get a warning that a DLL cannot be deleted, names slips my mind, but I think it's in the PlugIn folder. Can you tell me/us what I need to put into the CMD file which would allow me to nuke all the files?

User avatar
SelfMan
Posts: 958
Joined: 05 Apr 2006, 20:51
Contact:

Re: Portable Altap Salamander

Post by SelfMan » 05 Dec 2009, 04:10


User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 05 Dec 2009, 04:14

Georgd wrote:This is a really nice idea :) and very useful. I've worked through the code and made some changes that I wanna share with you; mainly it's improvements in avoiding and handling of errors. There are 2 TODOs that you might want to take care of :) And if you dislike to get status commands, be them pure information or errors, remove line 27 goto hide
I finally got the chance to play with this. Here's where I see there is a problem:

Code: Select all

rem Relative path to portable salamander directory (where portsal.reg and salamand.exe are). Do not add tailing \
set SalamanderPortableDir=.\PortableApps\SalamanderPortable

rem Settings, checks etc.
set RegBackupFile="%tmp%\SalamanderPortableRegBackup.reg"
if exist %RegBackupFile% goto :abort
if not exist "%SalamanderPortableDir%\portsal.reg" goto :noportsal
if not exist "%SalamanderPortableDir%\salamand.exe" goto :noportsal
If you have to set the path in this file, you just cannot take the CMD file and drop it within the Salamander folder and make it a portable. What I do is carry Salamander with me on a thumbdrive and I may copy the folder to a desktop, D drive, or another location and then run it. If I have to have a variable, I need to edit the file each time. It really is not a universal CMD/application.

I do like the idea of the command window with s status of what is going on. It would be nice if that window could be totally eliminated so it cannot be accidentally closed.

User avatar
vld
Posts: 174
Joined: 06 Feb 2009, 21:21

Re: Portable Altap Salamander

Post by vld » 05 Dec 2009, 04:21

SelfMan wrote:Get Unlocker
I don't think that is a good solution. I can't see installing application on someone elses system that is not needed. I can always kill the file after a reboot. I'd like to avoid doing that if possible.

User avatar
SvA
Posts: 458
Joined: 29 Mar 2006, 02:41
Location: DE

Re: Portable Altap Salamander

Post by SvA » 05 Dec 2009, 18:38

Most liekely, the file you cannot delete is the salamext.dll shell extension (a copy hook handler) which you should unregister (regsvr32 /u salamext.dll) and then register with the system for later deletion e.g using sysinternals movefile.
I agree that forcefully deleting the file is not a good idea as this might cause problems with the shell (i.e Explorer) or just any application interacting with the shell.
If you don't need the shell extension, you can avoid to have it registerd by not copying it or renaming it or moveing it to a different location prior to running Salamand.exe. The purpose of the extension is to support copy/move to/from plugin filesystems (e.g. when browsing an archive like a folder).

User avatar
SelfMan
Posts: 958
Joined: 05 Apr 2006, 20:51
Contact:

Re: Portable Altap Salamander

Post by SelfMan » 05 Dec 2009, 20:32

I didn mean to install the Unlocker on all the computers but on your test machine for testing. Unlocker displays which file is locked by which process, so you dont have to guess. (sorry I didn't have time to explain)
But as SvA pointed out, its probably the salamext.dll .

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5196
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Portable Altap Salamander

Post by Jan Rysavy » 05 Dec 2009, 21:47

As SvA mentioned, the salamext.dll is optional. As shell extension it is loaded into other processes and can be deleted after you logout (we are using delayed delete in Salamander uninstaller).

Shell extensions certainly should not be part of portable applications.

Post Reply