From 9b247a40be687effc0acd89e0414e7f353539b6f Mon Sep 17 00:00:00 2001 From: joten Date: Thu, 12 Feb 2015 19:36:52 +0100 Subject: [PATCH] Made the "remote control" support multiple lines. --- doc/Usage.md | 26 +++++++++++++++++++++----- src/Bar.ahk | 3 ++- test/RemoteControl.ahk | 14 +++++++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/doc/Usage.md b/doc/Usage.md index 8bb9c10..48bbac0 100644 --- a/doc/Usage.md +++ b/doc/Usage.md @@ -23,13 +23,29 @@ the list. is accessible by cklickig on `#!` on the right end of the bug.n bar. You may also send commands to bug.n from another AutoHotkey script. The sent -string is interpreted and executed by bug.n either as a bug.n-function (as used -in the hotkey configuration), the `Run` or `Send` command of AutoHotkey. For -example, you may use the following lines in an AutoHotkey script: +string is interpreted and executed by bug.n as one or more (separated by the +newline character ``n`) either bug.n-functions (as used in the hotkey +configuration) or AutoHotkey-commands (only `Run` or `Send`). For example, you +may use the following lines in an AutoHotkey script: + ;; The following line is required. DetectHiddenWindows, On - ;; ControlSetText, Edit2, % "()", bug.n_BAR_0 - ControlSetText, Edit2, % "Monitor_activateView(4)", bug.n_BAR_0 + + ;; Syntax: + ;; ControlSetText, Edit2, % "()", bug.n_BAR_0 + + ;; 1st example: + ;ControlSetText, Edit2, % "Monitor_activateView(4)", bug.n_BAR_0 + + ;; 2nd example: + ;ControlSetText, Edit2, % "Monitor_activateView(4)`nView_setLayout(3)", bug.n_BAR_0 + + ;; 3rd example: + ControlSetText, Edit2, % "Monitor_activateView(4)`nRun, explorer.exe", bug.n_BAR_0 + +It might be necessary to put a `Sleep, `, e. g. +`Sleep, 200`, between to consecutive `ControlSetText` to give bug.n time to +recognize the next command. ### Concepts diff --git a/src/Bar.ahk b/src/Bar.ahk index 101dc3c..07add82 100644 --- a/src/Bar.ahk +++ b/src/Bar.ahk @@ -207,7 +207,8 @@ Bar_cmdGuiEnter: } Else If (A_GuiControl = "Bar_#0_#1") { Gui, Submit, NoHide Debug_logMessage("DEBUG[6] Bar_cmdGuiEnter; command: " . Bar_#0_#1, 6) - Main_evalCommand(Bar_#0_#1) + Loop, Parse, Bar_#0_#1, `n, `r + Main_evalCommand(A_LoopField) } Return diff --git a/test/RemoteControl.ahk b/test/RemoteControl.ahk index 1bbbe40..fd48748 100644 --- a/test/RemoteControl.ahk +++ b/test/RemoteControl.ahk @@ -1,4 +1,16 @@ ;; Just use this to send commands + +;; The following line is required. DetectHiddenWindows, On + +;; Syntax: ;; ControlSetText, Edit2, % "()", bug.n_BAR_0 -ControlSetText, Edit2, % "Monitor_activateView(4)", bug.n_BAR_0 + +;; 1st example: +;ControlSetText, Edit2, % "Monitor_activateView(4)", bug.n_BAR_0 + +;; 2nd example: +;ControlSetText, Edit2, % "Monitor_activateView(4)`nView_setLayout(3)", bug.n_BAR_0 + +;; 3rd example: +ControlSetText, Edit2, % "Monitor_activateView(4)`nRun, explorer.exe", bug.n_BAR_0