Is it possible for hot keys I configure to only be active on one user? My PC is shared

Get help with using AutoHotkey and its commands and hotkeys
User avatar
divanebaba
Posts: 795
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Is it possible for hot keys I configure to only be active on one user? My PC is shared

19 Apr 2020, 08:14

Hello and welcome to the AHK-Forum.

For your task, I only know an easy workaround solution.
You just need a small Gui then you can work with #IfWinExist
That means you always have to start this gui when you log in or you put this gui-program into your personal autostart-folder.

Code: Select all

#IfWinExist MyUnvisibleGui
F7::
msgbox Hello Gui
return	
#If
BNOLI
Posts: 548
Joined: 23 Mar 2020, 03:55

Re: Is it possible for hot keys I configure to only be active on one user? My PC is shared

19 Apr 2020, 10:08

Code: Select all

If (A_Username !=  "orosoros")    ; if the currently logged in user isn't identical with orosoros
    ExitApp                       ; ... exit script.
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
gregster
Posts: 4493
Joined: 30 Sep 2013, 06:48

Re: Is it possible for hot keys I configure to only be active on one user? My PC is shared

19 Apr 2020, 10:29

Assuming you want to start your script automatically at startup, you could use your current user account's personal startup folder, instead of using the startup folder for all users: https://www.thewindowsclub.com/startup-folder-in-windows-8
(Afaik, this was also already possible on Win7.)

This could also be combined with other techniques, like checking A_username in the script to prevent unintentional starting of the script by a different user.
BNOLI
Posts: 548
Joined: 23 Mar 2020, 03:55

Re: Is it possible for hot keys I configure to only be active on one user? My PC is shared

20 Apr 2020, 04:05

Auftrag: Kind aus der Wanne holen. Aktion: Kind mit dem Bade ausschütten. Ergebnis: Auftrag erfüllt! :mrgreen:
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
gregster
Posts: 4493
Joined: 30 Sep 2013, 06:48

Re: Is it possible for hot keys I configure to only be active on one user? My PC is shared

20 Apr 2020, 09:07

divanebaba wrote:
20 Apr 2020, 03:42
Hello BNOLI, hello gregster.
Your solutions are not deactivating hotkeys. They are deactivating the whole script. :shock: :mrgreen: :mrgreen:
How do you know there is something else in the script? :)
If you don't have details, you make reasonable assumptions, and/or assumptions that you personally like ;) (for example, that the users use different user accounts). Also, the mentioned A_username could be used with #If, (de-)activating specific hotkeys.
User avatar
divanebaba
Posts: 795
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Is it possible for hot keys I configure to only be active on one user? My PC is shared

20 Apr 2020, 10:01

gregster wrote:
20 Apr 2020, 09:07
How do you know there is something else in the script? :)
...
Also, the mentioned A_username could be used with #If, (de-)activating specific hotkeys.
The headline talks from "hot keys". So why I should change this into "script"?
Your suggestion with #If combined with username is much better than my suggestion and should be preferred.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot] and 43 guests