That works; thank you!
Last time I tried using ..\ I didn't seem to have any luck, but that could've been because I had an improper variable included...
I'd still like to see %A_UserName% included though
This may help others too:
- Dropbox\AutoHotkey\Libraries\
Libraries folder; this is where things such as gdip should go...
- Dropbox\AutoHotkey\Setup\
The setup directory; it houses any files needing to be copied in addition to the setup bat file...
- AutoHotkey.ahk - Thanks wolf_II
Code: Select all
#Include %A_AppData%\..\..\Dropbox\AutoHotKey
#Include acecool_loader.ahk
- Setup_AutoHotkey_on_this_PC.bat
Code: Select all
@echo off
::
:: Setup AHK on this PC - Josh 'Acecool' Moser
::
::
:: Configuration
::
:: Path to where your cloud program stores files...
set CloudPath=%UserProfile%\DropBox
:: Path, from CloudPath, where you store your AHK Files...
set CloudAHKPath=\AutoHotkey
:: Path, from CloudPath, where you store your library Files...
set CloudAHKLibPath=%CloudAHKPath%\Libraries
:: Path, from CloudPath, where you store the AHK Setup Files...
set CloudAHKSetupPath=%CloudAHKPath%\Setup
:: AHK Installation Dir
set AHKInstallPath=C:\Program Files\AutoHotkey
echo Please verify the following paths before continuing... If incorrect, close the command prompt and make the appropriate changes before relaunching..
echo.
echo.
echo Cloud Path: %CloudPath%
echo Cloud AHK Files Path: %CloudPath%%CloudAHKPath%
echo Cloud AHK Libraries Path: %CloudPath%%CloudAHKLibPath%
echo Cloud Setup Files Path: %CloudPath%%CloudAHKSetupPath%
echo AHK Installation Path: %AHKInstallPath%
echo.
echo.
pause
:: Setup our backup file-name
set t=%time:~0,8%
set t=%t::=-%
set FileName=Backup %date%%t%
:: Paths to important locations...
set AHKPath=C:\Program Files\AutoHotkey
set LibPath=%AHKPath%\Lib
:: Check to see if the libraries directory has already been created ( unlikely )
echo Checking to see if the Libraries folder exists in the AHK Installation Directory: %AHKPath%
if exist "%LibPath%" (
:: It has, rename it...
echo Renaming "%LibPath%" to "\Lib %FileName%"
rename "%AHKInstallPath%\Lib" "Lib %FileName%"
) else (
echo "%LibPath%" wasn't found..
)
echo.
echo.
:: Create our symbolic link...
echo Trying to create our symbolic link...
mklink /D "%AHKInstallPath%\Lib" "%CloudPath%%CloudAHKLibPath%"
echo.
echo.
:: Read Registry...
echo. Reading the registry for the "My Documents" or "Documents" folder, including other languages, location...
FOR /F "usebackq tokens=2,* skip=2" %%L IN (
`reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal`
) DO SET DocumentsPath=%%M
:: Output Value...
echo Documents Folder Found: %DocumentsPath%
echo.
echo.
:: Check to see if AutoHotkey.ahk exists in the docs folder..
if exist "%DocumentsPath%\AutoHotkey.ahk" (
:: It does, so rename the default file, or whatever, to something else...
echo Renaming "%DocumentsPath%\AutoHotkey.ahk" to "\AutoHotkey %FileName%.ahk"
rename "%DocumentsPath%\AutoHotkey.ahk" "AutoHotkey %FileName%.ahk"
) else (
echo AutoHotkey.ahk wasn't found.. Copying the new one into %DocumentsPath%
)
:: Now, copy our loader file to the proper location..
copy "%CloudPath%%CloudAHKSetupPath%\AutoHotkey.ahk" "%DocumentsPath%"
pause
All of this is dynamic aside from the base folder structure for DropBox... You can put any contents into your AutoHotkey.ahk file inside Dropbox\AutoHotkey\Setup\ and on new machines just run the bat file to have the file copied to my documents ( any existing file will be renamed for backup purposes ), and the libraries symbolic link will be created inside of the AHK installation dir ( any existing folder will be renamed for backup purposes )... Then just run autohotkey.exe - simple...
I'm still hoping to see %A_UserName% included...
Edit: Added config options..