Page 1 of 1

Script help

Posted: 07 Dec 2019, 12:18
by cainxabel
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
}

Re: Script help

Posted: 07 Dec 2019, 13:04
by boiler
You need to make it the directive #If to apply to hotkeys, not If.

Re: Script help

Posted: 07 Dec 2019, 15:39
by cainxabel
boiler wrote: You need to make it the directive #If to apply to hotkeys, not If.
Oh sorry i do have the # symbol .

Re: Script help

Posted: 07 Dec 2019, 18:39
by boiler
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.

Re: Script help

Posted: 07 Dec 2019, 18:47
by cainxabel
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

Re: Script help

Posted: 07 Dec 2019, 18:58
by boiler
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?

Re: Script help

Posted: 07 Dec 2019, 19:18
by cainxabel
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

Re: Script help  Topic is solved

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

Code: Select all

MsgBox % A_AhkVersion

Re: Script help

Posted: 07 Dec 2019, 20:35
by cainxabel
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

Re: Script help

Posted: 07 Dec 2019, 20:45
by boiler
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