Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| user:geek:streamdeck [2022-06-26 13:00] – created geek | user:geek:streamdeck [2025-07-18 13:57] (current) – geek | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Stream Deck Ideas ====== | ====== Stream Deck Ideas ====== | ||
| - | Window | + | <code autohotkey> |
| + | #Include < | ||
| + | |||
| + | Persistent | ||
| + | |||
| + | ; From WebViewToo | ||
| + | ParseUri(Uri) { | ||
| + | static Pattern := " | ||
| + | if (!RegExMatch(String(Uri), | ||
| + | return | ||
| + | } | ||
| + | Parsed := {} | ||
| + | Parsed.Scheme := Match[" | ||
| + | Parsed.Port := Match[" | ||
| + | Parsed.Fragment := Match[" | ||
| + | return Parsed | ||
| + | } | ||
| + | |||
| + | ; From https:// | ||
| + | UrlUnescape(url) { | ||
| + | if r := DllCall(" | ||
| + | throw OsError(r) | ||
| + | return url | ||
| + | } | ||
| + | |||
| + | RecvLine(this, | ||
| + | newlinePos := 0 | ||
| + | ; MsgSize should block until some size is available. If there is | ||
| + | ; an error, it returns early with zero. | ||
| + | while size := this.MsgSize() { | ||
| + | ; Peek at what's in the buffer and only break when a | ||
| + | ; full line is available | ||
| + | this._recv(buf := Buffer(size), | ||
| + | if newlinePos := InStr(StrGet(buf, | ||
| + | break | ||
| + | Sleep 1 | ||
| + | } | ||
| + | this._recv(buf := Buffer(newlinePos), | ||
| + | data := StrGet(buf, encoding) | ||
| + | return keepEnd ? data : RTrim(data, ' | ||
| + | } | ||
| + | |||
| + | class DeckServer extends Socket.Server { | ||
| + | onACCEPT(err) { | ||
| + | client := this.AcceptAsClient() | ||
| + | request := StrSplit(RecvLine(client), | ||
| + | |||
| + | if request[1] != ' | ||
| + | client.SendText(' | ||
| + | Sleep 50 | ||
| + | return | ||
| + | } | ||
| + | |||
| + | uri := ParseUri(request[2]) | ||
| + | fname := LTrim(UrlUnescape(uri.Path), | ||
| + | |||
| + | if !(Buttons.HasOwnProp(fname)) { | ||
| + | client.SendText(' | ||
| + | Sleep 50 | ||
| + | return | ||
| + | } | ||
| + | |||
| + | args := Map() | ||
| + | for pair in StrSplit(uri.Query, | ||
| + | pair := StrSplit(pair, | ||
| + | args[UrlUnescape(pair[1])] := UrlUnescape(pair[2]) | ||
| + | } | ||
| + | |||
| + | SetTimer () => Buttons.%fname%(args), | ||
| + | client.SendText(' | ||
| + | Sleep 50 | ||
| + | return | ||
| + | } | ||
| + | } | ||
| + | |||
| + | server := DeckServer(1337, | ||
| + | |||
| + | ; --- User Functions --- | ||
| + | |||
| + | class Buttons { | ||
| + | static Example(args) | ||
| + | { | ||
| + | MsgBox args[' | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Window | ||
| * Full screen on left monitor | * Full screen on left monitor | ||
| * Full screen across both monitors (useful for VS Code) | * Full screen across both monitors (useful for VS Code) | ||
| * Full screen on right monitor | * Full screen on right monitor | ||
| + | * Toggle AlwaysOnTop | ||
| Shape tools: | Shape tools: | ||
| Line 24: | Line 112: | ||
| * Line endings | * Line endings | ||
| * CSV/TSV | * CSV/TSV | ||
| - | * JSON pretty print | + | * JSON pretty print / JSON as treeview |
| + | * Base64 encode/ | ||
| * Load image from file into clipboard (useful for memes or reference images to be pasted into Teams) | * Load image from file into clipboard (useful for memes or reference images to be pasted into Teams) | ||
| Line 34: | Line 123: | ||
| Snippets! The stream deck can send blocks of text but with AHK you can //paste// them for better performance. | Snippets! The stream deck can send blocks of text but with AHK you can //paste// them for better performance. | ||
| + | |||
| + | Open script in default editor | ||
| + | |||
| + | Reload script | ||