AutoHotkey Community

It is currently May 26th, 2012, 11:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: AHK for U3 FlashDrives
PostPosted: October 8th, 2009, 4:41 pm 
Offline

Joined: August 27th, 2009, 1:36 pm
Posts: 296
It would be awesome if someone could make AHK useable via a flashDrive, namely a U3.

If this is already done, and I missed it in my searchings, let me know :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 8th, 2009, 4:54 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Autohotkey should already be portable in that manner, you just have to download the zip file and extract the exe to your flash drive rather than downloading the installer.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 8th, 2009, 5:14 pm 
Offline

Joined: August 27th, 2009, 1:36 pm
Posts: 296
Oh, so it is :)

Thanks a lot :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 14th, 2009, 1:20 pm 
Offline

Joined: April 20th, 2006, 5:11 pm
Posts: 75
Location: Vienna
Well, creating a U3 Package isn't that hard. I've created one, but I haven't tested it jet (especially writing into registry and deleting OnExit).

DOWNLOAD AHK U3-Package (Right Click, Save Target as...)

The Launcher Code:
Code:
; regAHK
;

SetWorkingDir, %A_ScriptDir%
#NoEnv
#Singleinstance, ignore

If (1 = "/Src") {
   FileInstall, regAHK.ahk, regAHK.ahk, 1
   ExitApp
}

editr = %1%
OnExit, Cleanup
RegAHKExt()
Menu, Tray, NoStandard
Menu, Tray, Add, AutoHotkey Help File, helpfile
Menu, Tray, Add, AutoIt3 Window Spy, auspy
Menu, Tray, Add, AutoScriptWriter (recorder), record
Menu, Tray, Add
Menu, Tray, Add, AutoHotkey Website (ENG), ahkwseng
Menu, Tray, Add, AutoHotkey Website (DEU), ahkwsdeu
Menu, Tray, Default, AutoHotkey Help File
Return

Cleanup:
check := UnRegAHKExt()
If check {
   Sleep, 5000
   check := UnRegAHKExt()
}
If check {
   Msgbox, 16, ERROR, Some Registrykeys remained. Please delete them manually.
}
ExitApp
Return

helpfile:
Run, %A_Scriptdir%\AuotHotkey.chm
Return

auspy:
Run, %A_Scriptdir%\AU3_Spy.exe
Return

record:
Run, %A_Scriptdir%\AutoScriptWriter\AutoScriptWriter.exe
Return

ahkwseng:
Run, http://www.autohotkey.com
Return

ahkwsdeu:
Run, http://de.autohotkey.com
Return


RegAHKExt(launch=true, edit=true, compile=true) {
   global editr
   ahkdir := A_ScriptDir
   RegWrite, REG_SZ, HKEY_CLASSES_ROOT, .ahk, , AutoHotkeyScript
   RegWrite, REG_SZ, HKEY_CLASSES_ROOT, .ahk\ShellNew, FileName, %ahkdir%\Template.ahk
   RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir, %ahkdir%
   RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, Version, %A_AHKVersion%
   RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript, , AutoHotkey Script
   RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\DefaultIcon, , %ahkdir%\AutoHotkey.exe`,1
   RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell, , Open
   openscr := A_Language="0407" ? "Script starten" : "Run Script"
   editscr := A_Language="0407" ? "Script editieren" : "Edit Script"
   compscr := A_Language="0407" ? "Script kompilieren" : "Compile Script"
   If launch {
      RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Open, , %openscr%
      RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Open\Command, , %ahkdir%\AutoHotkey.exe "`%1"
   }
   If edit {
      editor := !editr ? "notepad.exe" : editr
      RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit, , %editscr%
      RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit\Command, , %editor% "`%1"
   }
   If compile {
      RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Compile, , %compscr%
      RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Compile\Command, , %ahkdir%\Compiler\Ahk2Exe.exe /in "`%1"
   }
   Return, 1
}

UnRegAHKExt() {
   RegDelete, HKEY_CLASSES_ROOT, AutoHotkeyScript
   err += Errorlevel
   RegDelete, HKEY_CLASSES_ROOT, .ahk
   err += Errorlevel
   RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey
   err += Errorlevel
   Return, err=0 ? true : false
}


If there's an issue, just modify the code, recompile it, open the u3p package with winrar, and move the compiled script with the name 'regAHK.exe' into the right folder ('Device').

Cheers
Obi-Wahn

PS.: Please notify my when there are Bugs.
PPS.: This script writes into registry. If there are any damages to the computer or the RegWrite doesn't work because of an lack of User-Rights, I'm not reponsible for.
PPPS.: The Package is tested with virustotal.com. 1 Hit out of 32. eSafe reports a malicious file (maybe upx.exe). I've compiled the script w/o UPX.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2009, 11:10 am 
I just copy/pasted AHK program file onto my thumb drive. Then when you run a .ahk file on a different computer and it ask what program to use to open it you find the ahk exe on the drive.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 2:14 am 
Offline

Joined: September 15th, 2009, 1:14 am
Posts: 562
-C3- wrote:
I just copy/pasted AHK program file onto my thumb drive. Then when you run a .ahk file on a different computer and it ask what program to use to open it you find the ahk exe on the drive.


What I did was to create a batch file that I had autorun execute on my flash drive.
Go here:
Quote:
http://ss64.com/nt/

Read up on ftype and assoc
then create a batch file that automatically associates autohotkey with that on your flash drive.
I also had my batch file associate a few other programs and also changed my flash drive's letter to z, which is what it is labeled as on my home computer. that way, if I have any hardcoded paths in ahk scripts or any other programs, then they would still work.
If you'd like to me to post my batch file for an example, let me know.
(I won't be able to till I get home from school,am currently on my laptop)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2010, 6:41 pm 
Offline

Joined: February 3rd, 2010, 12:47 pm
Posts: 38
Location: Zagreb, Croatia
Perhaps this can help:
http://www.lupopensuite.com/db/expresso.htm

You might want to check everything else on the Lupo pensuite pages as well.
Lots of interesting programs most of them free - really helpfull for compiling a handy flash memory "office in a pocket".


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2010, 3:51 am 
Offline

Joined: September 15th, 2009, 1:14 am
Posts: 562
bekihito wrote:
Perhaps this can help:
http://www.lupopensuite.com/db/expresso.htm

You might want to check everything else on the Lupo pensuite pages as well.
Lots of interesting programs most of them free - really helpfull for compiling a handy flash memory "office in a pocket".


Nice. I'll have to look into a little bit more when I get a chance.
But in my case, my batch script (which I just made an ahk file that will do this for me now), but anyways, it works just fine for my case as I use it at school only.
The school computers have a deep freeze program on it so everytime it's restarted, all settings go back to how they were. So I can do whatever I want, and it doesn't do a single thing to the computer.
I now have a rainmeter desktop, rocketdock, and a bunch of other mods that are done through an ahk script to setup the computer to my liking so I can be more "productive." :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2010, 5:10 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
http://ss64.com/nt/ very nice link i usually refer to microsofts command ref but i like this one better

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2010, 3:25 am 
Offline

Joined: September 15th, 2009, 1:14 am
Posts: 562
Wow. I never thought I'd have something tank would want to use. :D
Eventhough it's just a link....I'll take what I can get. haha.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group