HotkeylessAHK send param1

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

HotkeylessAHK send param1

02 Aug 2022, 18:05

https://github.com/sebinside/HotkeylessAHK

I just came across HotkeylessAHK, this is amazing and one of the best stuff I found on the internet.

I tried sending params but failing, would really appreciate if you could guide me somewhere.
Please do let me know if you need more information.


;#---------------------------------------------#
; attaching sample code

Code: Select all

; THIS IS WORKING :)
F10::
Run curl ""http://localhost:42800/send/helloworld"",,hide
return

HelloWorld(){
    MsgBox, HelloWorld
}

; #---------------------------------------------#
; THIS IS NOT WORKING :(

F11::
Run curl ""http://localhost:42800/send/yourNewFunction?param1=Hello&param2=World""
return

yourNewFunction(param1, param2){
    MsgBox, %param1% %param2%
}
Last edited by ahklearner on 03 Aug 2022, 06:46, edited 1 time in total.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: HotkeylessAHK send param1

02 Aug 2022, 19:36

This forum is fair game. I did also see on the page you referenced:
If there are more questions, you can contact me on Twitter or via mail.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: HotkeylessAHK send param1

03 Aug 2022, 03:04

Code: Select all

curl ""http://localhost:42800/send/yourNewFunction?param1=Hello&param2=World""
clearly not valid AHK code, idk what u tried to do there
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

Re: HotkeylessAHK send param1

03 Aug 2022, 06:46

sorry missed to add "run"
added in main code

Code: Select all

Run curl ""http://localhost:42800/send/yourNewFunction?param1=Hello&param2=World""
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

Re: HotkeylessAHK send param1

04 Aug 2022, 07:35

Hi Arif,

using parameters in calls is currently not supported. However, there is a simple solution that I also use in my personal scripts, e.g., here: https://github.com/sebinside/AutoHotkeyScripts/blob/master/source/lib/StreamDeckFunctions.ahk#L133

The idea is to make a parameterized function (e.g., ScarlettVolume) and then create parameterless functions that call this function (e.g., ScarlettVolume10) that call this function and can be called using HotkeylessAHK. If there are not that many different parameter variations, this works fine. If you need more variability, you would have to extend both the server and the AHK library of HotkeylessAHK. Feel free to make an issue or fork with that functionality, if required.

Best,
Sebastian
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

Re: HotkeylessAHK send param1

04 Aug 2022, 07:36

I plan to take this approach where I will share params via ini file, call function, and guide the function to read params from ini files.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 280 guests