Script help Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
cainxabel
Posts: 5
Joined: 07 Dec 2019, 12:13

Script help

07 Dec 2019, 12:18

Trying to switch out my function keys when using a program but for some reason it isn't working,
Someone mind helping me out

#If ProcessExist("FL64.exe")

1:: F1
2:: F2

#If

ProcessExist(Name)
{
Process,Exist,%Name%
return Errorlevel
}
Last edited by cainxabel on 07 Dec 2019, 15:40, edited 1 time in total.
User avatar
boiler
Posts: 3337
Joined: 21 Dec 2014, 02:44

Re: Script help

07 Dec 2019, 13:04

You need to make it the directive #If to apply to hotkeys, not If.
cainxabel
Posts: 5
Joined: 07 Dec 2019, 12:13

Re: Script help

07 Dec 2019, 15:39

boiler wrote: You need to make it the directive #If to apply to hotkeys, not If.
Oh sorry i do have the # symbol .
User avatar
boiler
Posts: 3337
Joined: 21 Dec 2014, 02:44

Re: Script help

07 Dec 2019, 18:39

Not sure what you mean by saying you want to switch out your function keys. The way you have it set up, you've mapped such that when you press 1, it's like you pressed F1. Same with 2 and F2, respectively. If you want to press F1 and it will act like you pressed 1 (and same with the other pair), you need to reverse them.
cainxabel
Posts: 5
Joined: 07 Dec 2019, 12:13

Re: Script help

07 Dec 2019, 18:47

boiler wrote:
07 Dec 2019, 18:39
Not sure what you mean by saying you want to switch out your function keys. The way you have it set up, you've mapped such that when you press 1, it's like you pressed F1. Same with 2 and F2, respectively. If you want to press F1 and it will act like you pressed 1 (and same with the other pair), you need to reverse them.
yeah i want to switch the number keys with the function keys for that program but i cant get it to work
User avatar
boiler
Posts: 3337
Joined: 21 Dec 2014, 02:44

Re: Script help

07 Dec 2019, 18:58

Well for one thing, what you have implemented won't just switch them for that program because you've made it so the remap is active if the process exists whether it's the active window or not. So as long as that program is running in the background, the remap will be active even when you're working in another program.

It's still not clear what you mean by switching them. If you want to switch them so 1 acts like F1 and F1 acts like 1 (as well as the other pair, then you need both):

Code: Select all

#If ProcessExist("FL64.exe")

1::F1
2::F2
F1::1
F2::2
#If

ProcessExist(Name)
{
Process,Exist,%Name%
return Errorlevel
}
If it's still not doing what you want, please describe in detail what you mean when you say that. Is it that it's always working (not just in that program)? Is it that it's doing nothing at all when you press certain keys? Which keys?
cainxabel
Posts: 5
Joined: 07 Dec 2019, 12:13

Re: Script help

07 Dec 2019, 19:18

boiler wrote:
07 Dec 2019, 18:58
Well for one thing, what you have implemented won't just switch them for that program because you've made it so the remap is active if the process exists whether it's the active window or not. So as long as that program is running in the background, the remap will be active even when you're working in another program.

It's still not clear what you mean by switching them. If you want to switch them so 1 acts like F1 and F1 acts like 1 (as well as the other pair, then you need both):

Code: Select all

#If ProcessExist("FL64.exe")

1::F1
2::F2
F1::1
F2::2
#If

ProcessExist(Name)
{
Process,Exist,%Name%
return Errorlevel
}
If it's still not doing what you want, please describe in detail what you mean when you say that. Is it that it's always working (not just in that program)? Is it that it's doing nothing at all when you press certain keys? Which keys?
yea the key swaps just arent working like if the script isn't running
i tried running it and get an error saying
"#If ProcessExist("FL64.exe")"
this line does not contain a recognized action
User avatar
boiler
Posts: 3337
Joined: 21 Dec 2014, 02:44

Re: Script help  Topic is solved

07 Dec 2019, 19:54

Are you using a very old version of AHK? What does it show when you run the following?

Code: Select all

MsgBox % A_AhkVersion
cainxabel
Posts: 5
Joined: 07 Dec 2019, 12:13

Re: Script help

07 Dec 2019, 20:35

boiler wrote:
07 Dec 2019, 19:54
Are you using a very old version of AHK? What does it show when you run the following?

Code: Select all

MsgBox % A_AhkVersion
is it possible to make the key changes program specific only and not universal? ie only for fl.exe and not chrome
User avatar
boiler
Posts: 3337
Joined: 21 Dec 2014, 02:44

Re: Script help

07 Dec 2019, 20:45

This would make the remappings active only when a window of the FL64.exe program is the active window:

Code: Select all

#If WinActive("ahk_exe FL64.exe")
1::F1
2::F2
F1::1
F2::2
#If

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], DRocks, loek6000, shadyindustries and 215 guests