Syncing: refer to 2 different file locations with 1 script?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Tim_H
Posts: 16
Joined: 05 Aug 2021, 19:43

Syncing: refer to 2 different file locations with 1 script?

30 Aug 2021, 20:00

I created a shortcut to open my Dropbox in File Explorer and I would like to run the script on 2 different computers.
Problem: the Adminstrator name is not the same on both devices...

PC 1: Run "C:\Users\Admin\Dropbox\"
PC 2: Run "C:\Users\NickNameX\Dropbox\"

For now I've created 2 different scripts - one for each device - that I try to keep in sync. But since there are many more shortcuts & shortstrings (the Dropbox one is just an example) this is a bit tedious.

Is there any workaround for this?
Like some kind of "joker" that I could write in the path and magically get the right result depending on the system? (like "C:\Users\%%%\Dropbox" or something?)


Needless to say I am a newbee, so please do explain all my obvious mistakes and illusions.... :d
(One thing I know that won't work though is changing the Administrator name - Windows will change it on "display" but the actual file paths will remain unchanged.
Apparently with Window you only get 1 chance to set your Administrator name right.)

Thanks in advance for any help or suggestion!
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Syncing: refer to 2 different file locations with 1 script?

30 Aug 2021, 20:23

Code: Select all

Run, % dropboxDir()

dropboxDir() {
 FileRead, ttext, % StrReplace(A_AppData, "Roaming", "Local\Dropbox\info.json")
 RegExMatch(ttext, """path"": ""(.+?)""", dir)
 Return StrReplace(dir1, "\\", "\")
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Kodakku and 367 guests