Running AHK resident on a USB device?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
etullock
Posts: 1
Joined: 19 Feb 2018, 16:57

Running AHK resident on a USB device?

19 Feb 2018, 17:10

Is there a way to run AHK resident on a USB device. Here is my scenario:

I have a KVM that allows the sharing of a USB device (stick or drive) that is plugged into the back of the KVM switch. That is, when the position one is selected, whatever USB device is plugged into the back of the KVM switch, I can access that drive from computer one. But, when I switch the KVM to computer 2, I still have access to the USB device plugged into the KVM device (acts as a shared storage device, or network drive, if you will).

Is there any way to get AHK to run on the USB device so that I have access to its use when on either machine (1 or 2)?

Thanks.
User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Running AHK resident on a USB device?

19 Feb 2018, 17:48

Unpack the AHK download and copy it to a folder on the USB drive. Then simply run it from there. For example, if the USB drive comes up as the F drive and the folder where you copied the unpacked AHK files is AutoHotkey and the folder where you have the scripts on the USB drive is MyScripts, then do this...

F:\AutoHotkey\AutoHotkeyA32.exe F:\MyScripts\ScriptFileName.ahk parameters

or

F:\AutoHotkey\AutoHotkeyU32.exe F:\MyScripts\ScriptFileName.ahk parameters

or

F:\AutoHotkey\AutoHotkeyU64.exe F:\MyScripts\ScriptFileName.ahk parameters

...depending on which version of AHK you want to use. Regards, Joe
garry
Posts: 3758
Joined: 22 Dec 2013, 12:50

Re: Running AHK resident on a USB device?

20 Feb 2018, 16:31

test script with msgbox to show the last 2 drives
a part from my script , which I used to copy a folder from computer to USB (C>D) and then copy from USB to another computer (E>D)

Code: Select all

drivegetshow:
i=0
alldrives:=""
DriveGet, A, List,
StringSplit,D, A,
loop,%d0%
{
DRV:= % d%a_index% . ":\"
i++
      DriveGet       , type1   , type     , %DRV%     ;- removable / fixed
      DriveGet       , cap1    , capacity , %DRV%
      DrivespaceFree , free1   ,            %DRV%
      DriveGet       , fs1     , fs       , %DRV%     ;- FAT
      DriveGet       , label1  , label    , %DRV%     ;- volume label >\\server1
      DriveGet       , serial1 , serial   , %DRV%     ;- volume serial number
      DriveGet       , status1 , status   , %DRV%
  alldrives .= drv . "  "
  msgbox, 262208,Drive-Info_%i% ,%DRV%  %type1%  %label1%  %fs1%  %cap1%-MB  %free1%-MB  %status1%
}
VT:=D0       ;- totaldrives
VL:=(D0-1)   ;- totaldrives-1
last         = %drv%
loop,%vl%
  secondlast   := % d%a_index% . ":\"

msgbox,TotalDrives=%vt%`nALL=%alldrives%`n------------------`nSecondlast=%secondlast%`nLast=%drv%

; drv is the last drive
64bit:=a_is64bitOs
if (64bit=0)
msgbox, %drv%AutoHotkey\AutoHotkeyU32.exe "%drv%MyScripts\ScriptFileName.ahk"
else
msgbox,%drv%AutoHotkey\AutoHotkeyU64.exe "%drv%MyScripts\ScriptFileName.ahk"
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Billykid, Descolada, Haris00911, Swiftly9767 and 292 guests