All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Jul 15, 2023 11:50 pm 
User avatar

Joined: Sun Dec 23, 2018 7:44 pm
Posts: 819
Location: Texas, USA
Hi. So I've been messing with AutoHotkey and trying to set up a couple of hotkeys for restarting soundcards and toggling bypass. I have the soundcard restarting function working. I have the ability to turn on or turn off the bypass by forcing a value (0 or nonzero).

However, I don't know how to do a Bypass toggle that doesn't need to query the current state and make a decision on what to respond with. I was hoping just sending the "237" signal would work to toggle whatever the state is; like 10439 restarts soundcards without having to force a value.

Right Ctrl+Numpad Divide send a restart signal to the soundcards with this:
Code:
>^NumpadDiv::
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://127.0.0.1:8080/json-1/list`%7B`%2210439`%22`%7B`%7D`%7D", false)
try whr.Send()
this is the actual URL it sends http://127.0.0.1:8080/json-1/list%7B"10439"%7B%7D%7D which works for its button.

However, this command for Right Ctrl+Numpad Multiply does not do anything unless I tell it a value to force.
Code:
>^NumpadMult::
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://127.0.0.1:8080/json-1/list`%7B`%22237`%22`%7B`%7D`%7D", false)
try whr.Send()
http://127.0.0.1:8080/json-1/list%7B"237"%7B%7D%7D is the URL.

However, this URL DOES turn off the bypass
http://127.0.0.1:8080/json-1/list%7B%22 ... 0%22%7D%7D

And this URL enables it (same with the value 1 or -1. Sadly -1 doesn't toggle it either)
http://127.0.0.1:8080/json-1/list%7B%22 ... 1%22%7D%7D

Is anybody familiar enough with JSON and AutoHotkey to where they can help me make a script that can check its state, then send an opposing value? Should I contact Hans and ask for an easy toggle function to call that doesn't require a specific value to work?

Thanks!

edit2: Optimially I think it would be handy to be able to force a new_value of "-1" and have Stereo Tool toggle the bypass from its current state (before re-setting the value appropriately internally or whatever makes it work the next time it's sent).


edit1: fixed up some grammar and added some links


Top
   
PostPosted: Tue Aug 08, 2023 10:01 pm 
User avatar

Joined: Sun Dec 23, 2018 7:44 pm
Posts: 819
Location: Texas, USA
Thanks to @TheDaChicken for helping me figure out this Bypass hotkey. Press CTRL+/ on the numpad to toggle the bypass.
Code:
^NumpadMult::  ; 237 = Bypass TOGGLE
CurrentValue := GetResponse() ;; Get current value
NewValue := (InStr(CurrentValue """value"": ""1""", false) != 0) 
byp0 := ComObjCreate("WinHttp.WinHttpRequest.5.1")
byp0.Open("GET", "http://127.0.0.1:8080/json-1/list%7B%22237%22%3A%7B%22forced%22%3A%221%22%2C%20%22new_value%22%3A%20%22"
   . NewValue . "%22%7D%7D", true)
try byp0.Send()
Return


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+02:00


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited