 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
meep.com
Joined: 11 Feb 2009 Posts: 5
|
Posted: Wed Feb 11, 2009 2:08 am Post subject: Trying to Make AHK Portable...Not Succeeding :( |
|
|
Hi everyone!
First off, I'm a real newbie to scripting, so please forgive any mistakes I make.
Anyways, I discovered AutoHotkey about a week ago, and put it on my home computer. Trouble is, most of my work is on multiple computers (I find myself hitting the hotkeys for my home pc, and when it doesn't work, I get sad).
So I tried to make AHK portable...and all I really need is for it to open up my folders
(eg: #f::Run L:\School\AP Biology\)
However, when I go to another computer, it says "blah blah cannot find etc."
| Code: | ; My Scripts (mribeiro)
; --------------------------------------------------------------------------
; Minimize
!F2:: WinMinimize, A
; Maximize/Restore
!F3::
WinGet MX, MinMax, A
If MX
WinRestore A
Else WinMaximize A
return
; Window Always on Top
#q::Winset, Alwaysontop, , A
; CapsLock Alt-Tab
#InstallKeybdHook
#Persistent
#HotkeyInterval,100
CapsLock::
{
send,{lalt down}{tab}
sleep 10
send, {lalt up}
Return
}
; Portable
; HOTKEYS QUICK REFERENCE
; --------------------------------------------------------------------------
; ! Alt
; ^ Ctrl
; + Shift
; # Winkey
; PATHS IN THE KEYDRIVE
; --------------------------------------------------------------------------
; PROGRAMS DIRECTORY X:\Storage\Apps
; SAMPLE PROGRAM PATH X:\Storage\Apps\FirefoxPortable\FirefoxPortable.exe
; AUTOHOTKEY ENGINE X:\Storage\Apps\AutoHotkey\AutoHotkey.exe
; AUTOHOTKEY SCRIPT X:\Storage\Apps\AutoHotkey\mribeiro-portable.ahk
; DOCUMENTS DIRECTORY X:\School
; EXTERNAL SCRIPTS TO INCLUDE
; --------------------------------------------------------------------------
; A file with many long scripts and threads can be difficult to maintain.
; You can save long scripts as separate ahk files in the same directory
; as the main script, and call them by means of the directive #Include.
#Include %A_ScriptDir%
#Include WindowManipulation.ahk
; RUN USB APPLICATIONS
; --------------------------------------------------------------------------
; Paths below are relative to the directory of the script, (see variable
; %A% at the top). The string in the second parameter of Run is the working
; directory. Not all programs need this, but some do. Include it to be safe.
#z::Run, L:\Storage\Apps\FirefoxPortable\FirefoxPortable.exe
; OPEN A DIRECTORY IN THE USB Drive
; --------------------------------------------------------------------------
#f::Run, L:\School ; Open X:\School in default file manager. |
(BTW I copied part of this script: http://kikizas.net/en/usbapps.ahk.html)
Is there anything I can do to make it work?
Please help
Thanks |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Wed Feb 11, 2009 2:13 am Post subject: |
|
|
| Quote: | | it says "blah blah cannot find etc." |
please be more specific!
what error happend when exactly? |
|
| Back to top |
|
 |
Slanter
Joined: 28 May 2008 Posts: 739 Location: Minnesota, USA
|
Posted: Wed Feb 11, 2009 4:10 am Post subject: |
|
|
The paths to the files would need to be something like the following, because the root drive may change. | Code: | D := SubStr(A_ScriptFullPath, 1, 1)
Run, %D%:\Storage\Apps\FirefoxPortable\FirefoxPortable.exe |
_________________ Unless otherwise stated, all code is untested
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
deportivo5
Joined: 05 Sep 2008 Posts: 44
|
Posted: Wed Feb 11, 2009 6:33 am Post subject: |
|
|
another suggestion is to use "SetWorkingDir %A_WorkingDir%"
hope this will be useful =X _________________ I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
Lou Cefer
Joined: 27 Oct 2008 Posts: 24
|
Posted: Wed Feb 11, 2009 1:16 pm Post subject: |
|
|
| did you compile the script before transfering it? |
|
| Back to top |
|
 |
meep.com
Joined: 11 Feb 2009 Posts: 5
|
Posted: Thu Feb 12, 2009 10:59 pm Post subject: |
|
|
thanks to everyone who replied
i tried Slanter's idea and it works
just as another question, can i make permanent shortcuts from autohotkey (portable) to my desktop even if the drive letter changes? |
|
| Back to top |
|
 |
BoBoł Guest
|
Posted: Thu Feb 12, 2009 11:08 pm Post subject: |
|
|
| Brainfart. Link the shortcut to a local (compiled) AHK-script which checks for removable drives, and execute AHK (or update the registry) once its destination has been identified. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Thu Feb 12, 2009 11:15 pm Post subject: |
|
|
| meep.com wrote: | | make permanent shortcuts from autohotkey (portable) to my desktop even if the drive letter changes? |
Define "permanent". The LNK files becomes stale as soon as you remove your drive!
But you can Create or Repair shortcuts with FileGetShortcut/FileCreateShortcut commands
See: Crazy Scripting : Quick Launcher for Portable Apps |
|
| Back to top |
|
 |
I should register
Joined: 18 Jan 2009 Posts: 15
|
Posted: Fri Feb 13, 2009 7:59 pm Post subject: |
|
|
New script:
| Code: |
; My Scripts (mribeiro) ;edited >:D
; --------------------------------------------------------------------------
SplitPath, A_ScriptDir,,,,, ThumbDrive ; %ThumbDrive% is the variable that contains it's drive's letter.
; Minimize
!F2:: WinMinimize, A
; Maximize/Restore
!F3::
WinGet MX, MinMax, A
If MX
WinRestore A
Else WinMaximize A
return
; Window Always on Top
#q::Winset, Alwaysontop, , A
; CapsLock Alt-Tab
#InstallKeybdHook
#Persistent
#HotkeyInterval,100
CapsLock::
{
send,{lalt down}{tab}
sleep 10
send, {lalt up}
Return
}
; Portable
; HOTKEYS QUICK REFERENCE
; --------------------------------------------------------------------------
; ! Alt
; ^ Ctrl
; + Shift
; # Winkey
; PATHS IN THE KEYDRIVE
; --------------------------------------------------------------------------
; PROGRAMS DIRECTORY X:\Storage\Apps
; SAMPLE PROGRAM PATH X:\Storage\Apps\FirefoxPortable\FirefoxPortable.exe
; AUTOHOTKEY ENGINE X:\Storage\Apps\AutoHotkey\AutoHotkey.exe
; AUTOHOTKEY SCRIPT X:\Storage\Apps\AutoHotkey\mribeiro-portable.ahk
; DOCUMENTS DIRECTORY X:\School
; EXTERNAL SCRIPTS TO INCLUDE
; --------------------------------------------------------------------------
; A file with many long scripts and threads can be difficult to maintain.
; You can save long scripts as separate ahk files in the same directory
; as the main script, and call them by means of the directive #Include.
#Include %A_ScriptDir%
#Include WindowManipulation.ahk
; RUN USB APPLICATIONS
; --------------------------------------------------------------------------
; Paths below are relative to the directory of the script, (see variable
; %A% at the top). The string in the second parameter of Run is the working
; directory. Not all programs need this, but some do. Include it to be safe.
#z::Run, %ThumbDrive%\Storage\Apps\FirefoxPortable\FirefoxPortable.exe
; OPEN A DIRECTORY IN THE USB Drive
; --------------------------------------------------------------------------
#f::Run, %ThumbDrive%\School ; Open X:\School in default file manager,
|
I changed it a little bit, you should be able to open your programs on
any PC.
I also use FFP at school . |
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 1886 Location: Germany
|
Posted: Fri Feb 13, 2009 8:53 pm Post subject: |
|
|
May be this could be interest you.
Mount any path as a drive with subst.exe:
http://www.autohotkey.com/forum/viewtopic.php?t=17090
If this works for you, so let me know about. Include the file mount.lib.ahk in your script with #Include Mount.lib.ahk and you can use the functions then.
Or you can use the existing examples coming up with the archive. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|