You are here

To John Bentley, Xenon author, AutoIt3 expert - re: portablizing AutoIt3

9 posts / 0 new
Last post
RogerL
Offline
Last seen: 6 months 1 week ago
Joined: 2007-03-14 09:17
To John Bentley, Xenon author, AutoIt3 expert - re: portablizing AutoIt3

Can AutoIt3 (plus it's special version of SciTE that comes with it) be run from a USB drive? I have searched the forums, found 3 requests for info on this but no definitive answers.

digitxp
digitxp's picture
Offline
Last seen: 13 years 8 months ago
Joined: 2007-11-03 18:33
Yes,

it's already portable, as is autohotkey ...
Check out portablefreeware.com for instructions on how to portableize

Insert original signature here with Greasemonkey Script.

John Bentley
John Bentley's picture
Offline
Last seen: 15 years 9 months ago
Developer
Joined: 2006-01-24 13:26
It's hard to say. AutoIt

It's hard to say. AutoIt itself is portable. I don't know for sure about Scite, but it runs off a USB stick. I don't know where it saves its settings though. If you don't care about settings it will run from a USB stick though. Just use the zip files that AI supplies.

cowsay Moo
cowthink 'Dude, why are you staring at me.'

wraithdu
Offline
Last seen: 11 years 11 months ago
Developer
Joined: 2007-06-27 20:22
It is like 98% portable out

It is like 98% portable out of the box. AutoIt leaves two reg entries behind (I don't know why) -

HKCU\Software\Hiddensoft
HKLM\Software\Hiddensoft

SciTE is portable except for the settings files which it saves in your profile directory. But you can get around this by the launcher creating a temporary environment variable called

SciTE_HOME

and pointing it anywhere you want to store the settings files.

However AutoIt3 is freeware, so cannot be repackaged.

SciTE4AutoIt3 is mostly OpenSource. There are a few utilities like Tidy and Obfuscator which are not, and I don't know what license it is under, so it also cannot be (entirely) repackaged.

As for portability, there are some settings changes that need to be made in the properties files to change from static to relative paths, and SciteConfig.exe needs to be recompiled with relative instead of static paths. Tidy and Obfuscator are closed source (to my knowledge) and I don't know how to portabalize them yet (I have a question in their forum about that).

So yes, it can be done (I've done it), but it's a bit of work, and cannot be fully packaged Sad

RogerL
Offline
Last seen: 6 months 1 week ago
Joined: 2007-03-14 09:17
wraithdu, Thanks very much

wraithdu, Thanks very much for the detail in the above. I had a search for your posts in the AutoIt forum, wow...respect! If I had known you were an AutoIt expert too I would have included you in the subject of the OP. Your apps in Dev Test Releases list aren't under your wraithdu moniker but your real name. Had to do some detective work!

A few questions on your post:

1. Have you created a launcher for SciTE yourself which handles the reg entries?
2. If yes, can you share it?
3. If not, how do you get the SciTE launcher to create a temp env var?
4. Have you had a satisfactory reply in their forum to your question?

TIA, Roger

wraithdu
Offline
Last seen: 11 years 11 months ago
Developer
Joined: 2007-06-27 20:22
Thanks for the compliment!

Thanks for the compliment! Ha, but I'm no expert, I muddle through Wink

Here's my launcher for SciTE. It's in NSIS, handles the environment variable, but does not delete the reg keys. That's becuase I just wrote a simple launcher, not a wrapper. I run a cleanup script when I'm done with all my apps that cleans those entries. But I'll throw in a modified version at the end if you want to wrap the whole thing.

; ----- Basic informations
!define AUTHOR 	"wraithdu"		; your name
!define APP 	"SciTEPortable"		; insert application name, e.g. "TestApp"
!define VER 	"1.0.0.2"	; insert version of launcher
!define EXE	"SciTe.exe"		; name of executable
!define ICON 	"${APP}.ico"
	
; **************************************************************************
; *  Compiler Flags (to reduce executable size, saves some bytes)
; **************************************************************************
SetDatablockOptimize on
SetCompress force
SetCompressor /SOLID /FINAL lzma

; **************************************************************************
; *  Includes
; **************************************************************************
!include "FileFunc.nsh"
!insertmacro "GetParameters"

; **************************************************************************
; *  Runtime Switches
; **************************************************************************
CRCCheck On ; do CRC check on launcher before start
SilentInstall Silent ; start as launcher, not as installer
AutoCloseWindow True ; automatically close when finished
XPStyle On ; XP style dialogs

; **************************************************************************
; *  Set basic information
; **************************************************************************
Name "${APP}"
Icon "${ICON}"
Caption "${APP} - ${VER}"
OutFile "${APP}.exe"
RequestExecutionLevel user

; **************************************************************************
; *  Set version information
; **************************************************************************
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
VIProductVersion "${VER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" ""
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Launcher created by ${AUTHOR}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "by ${AUTHOR}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "${APP}.exe"

; **************************************************************************
; *  Main section
; **************************************************************************
Section
	; *** Check whether EXE is launched a second time
	FindProcDLL::FindProc "${EXE}"
	StrCmp $R0 0 0 RunApp
	
	; *** Set variables for PStart environment
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("SciTE_HOME", "$EXEDIR").r0'
	StrCmp $0 0 0 RunApp
		MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "Can't set environment variable."
		Abort
	
	RunApp:
	; *** Get passed parameters
	Call GetParameters
	Pop $0
	; *** Run app
	Exec '"$EXEDIR\SciTE.exe" $0'
SectionEnd

If you want to wrap the whole thing (launcher stays running) -

; ----- Basic informations
!define AUTHOR 	"wraithdu"		; your name
!define APP 	"SciTEPortable"		; insert application name, e.g. "TestApp"
!define VER 	"1.0.0.2"	; insert version of launcher
!define EXE	"SciTe.exe"		; name of executable
!define ICON 	"${APP}.ico"
	
; **************************************************************************
; *  Compiler Flags (to reduce executable size, saves some bytes)
; **************************************************************************
SetDatablockOptimize on
SetCompress force
;SetCompressor /SOLID /FINAL lzma

; **************************************************************************
; *  Includes
; **************************************************************************
!include "FileFunc.nsh"
!insertmacro "GetParameters"
!include Registry.nsh

; **************************************************************************
; *  Runtime Switches
; **************************************************************************
CRCCheck On ; do CRC check on launcher before start
SilentInstall Silent ; start as launcher, not as installer
AutoCloseWindow True ; automatically close when finished
XPStyle On ; XP style dialogs

; **************************************************************************
; *  Set basic information
; **************************************************************************
Name "${APP}"
Icon "${ICON}"
Caption "${APP} - ${VER}"
OutFile "${APP}.exe"
RequestExecutionLevel user

; **************************************************************************
; *  Set version information
; **************************************************************************
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
VIProductVersion "${VER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" ""
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Launcher created by ${AUTHOR}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "by ${AUTHOR}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "${APP}.exe"

; **************************************************************************
; *  Main section
; **************************************************************************
Section
	; *** Check whether EXE is launched a second time
	FindProcDLL::FindProc "${EXE}"
	StrCmp $R0 0 0 RunAppExit
	
	; *** Set variables for PStart environment
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("SciTE_HOME", "$EXEDIR").r0'
	StrCmp $0 0 0 RunApp
		MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "Can't set environment variable."
		Abort
	
        RunApp:
	; *** Get passed parameters
	Call GetParameters
	Pop $0
	; *** Run app
	ExecWait '"$EXEDIR\SciTE.exe" $0'
	${registry::DeleteKey} "HKLM\Software\Hiddensoft" $0
	${registry::DeleteKey} "HKCU\Software\Hiddensoft" $0
		Abort ; exit
		
	RunAppExit:
	; *** Get passed parameters
	Call GetParameters
	Pop $0
	; *** Run app
	Exec '"$EXEDIR\SciTE.exe" $0'
		Abort ; exit	
SectionEnd

Put the launcher in the same directory as SciTE. You'll need to Registry plugin to compile this script, and an icon called SciTEPortable.ico (custom, or extracted from the SciTE executable). Or just comment out the icon line to use the default NSIS icon.

Obfuscator has been updated by the dev to search for AutoIt relative to its own directory first, instead of trying to read the registry like it did before. When he releases that update it will work just fine portably (hopefully soon).

SciteConfig.exe, to my knowledge, has not been updated yet. But the source is included, so can be recompiled. Here are my changes in line 23 -

$SciTE_Dir = @ScriptDir & "\.."

and line 48 -

Global $autoit3dir = @ScriptDir & "\..\.."

and recompile it.

I'm going to request the author update SciteConfig.exe similarly to Obfuscator.

RogerL
Offline
Last seen: 6 months 1 week ago
Joined: 2007-03-14 09:17
wraithdu, thanks very much

wraithdu, thanks very much indeed for this. I'm going to study it later when I have built up some more Brownie points with my wife. She is complaining I'm spending too much time on portableapps.com and not getting the honey-do jobs done. Anyway hope I can ask some more questions later...

wraithdu
Offline
Last seen: 11 years 11 months ago
Developer
Joined: 2007-06-27 20:22
No problem. I hear the same

No problem. I hear the same stuff from my girl too Wink Anyway, here's the beta site where the dev posts interim builds of stuff (has the Obfuscator fix) -

http://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/

wraithdu
Offline
Last seen: 11 years 11 months ago
Developer
Joined: 2007-06-27 20:22
The new beta of

The new beta of SciteConfig.exe is up. I tested it and got the path code tweaked so it's portable ready now. Same site as above.

Log in or register to post comments