AutoHotkey Community

It is currently May 26th, 2012, 6:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: February 11th, 2009, 3:08 am 
Offline

Joined: February 11th, 2009, 2:59 am
Posts: 5
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2009, 3:13 am 
Quote:
it says "blah blah cannot find etc."

please be more specific!
what error happend when exactly?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2009, 5:10 am 
Offline

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2009, 7:33 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2009, 2:16 pm 
Offline

Joined: October 27th, 2008, 2:19 pm
Posts: 24
did you compile the script before transfering it?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2009, 11:59 pm 
Offline

Joined: February 11th, 2009, 2:59 am
Posts: 5
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2009, 12:08 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2009, 12:15 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2009, 8:59 pm 
Offline

Joined: January 18th, 2009, 9:03 pm
Posts: 15
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 :D.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2009, 9:53 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
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.


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: batto, Bing [Bot], rbrtryn and 59 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