- October 30, 2013 at 12:42 pm #17409Bill_StewartParticipant
I was trying to write a macro to implement a single-keystroke incremental search:
1) Enable Find Toolbar if not enabled
2) Set focus to Find Toolbar
3) Enable Incremental Search on toolbar
Short test script:
var eeStatus = editor.QueryStatusByID(EEID_FINDBAR_INCREMENTAL); alert(eeStatus);
However eeStatus doesn’t reflect whether Incremental Search is checked or not. So it seems QueryStatusByID method doesn’t work for this EEID_FINDBAR_INCREMENTAL command ID.
Is this correct, or am I doing something wrong?
If this is correct, I would like to request that QueryStatusByID reflect state for this command ID.
BillOctober 31, 2013 at 12:17 am #17410
“EEID_FINDBAR_INCREMENTAL” is not a ID, but a string, the name of that command.
The ID is 4571
See EmEditor Help – Command Reference – Search category
Incremental Search (Find toolbar) command
Toggles the Incremental Search button on the Find toolbar.
Toggles the Incremental Search button on the Find toolbar. When Incremental Search is activated,
EmEditor will search and highlight results as the user types.
How to Run
Default Menu: None
All Commands: Search > Find Toolbar > Incremental Search
Status Bar: None
Default Shortcut Key: None
Plug-in Command ID
Also take a look in the help for EmEditor Macro Reference – Editor Object > QueryStatusByID Method
Retrieves the current status of the specified command, whether it is enabled and checked.
nStatus = editor.QueryStatusByID( nID );
Specifies an integer indicating the Command ID to execute.
See the Command Reference for the list of available commands.
Returns a combination of the following values.
eeStatusEnabled The command is enabled.
eeStatusLatched The command is checked.
.October 31, 2013 at 12:55 am #17411
But I get always a “2” for eeStatus, no matter if the button is in pressed state or not? :confused:
editor.ExecuteCommandByID(4571); //Toggles the Incremental Search BUTTON on the Find toolbar var eeStatus = editor.QueryStatusByID(4571); alert("eeStatus: " + eeStatus); // 2 alert("eeStatusLatched: " + eeStatusLatched ); // 4 alert("eeStatusEnabled: " + eeStatusEnabled ); // 2
The toggle command “4571” works, but we can’t get the state of that button back with QueryStatusByID().
Me think, “4571” is not the ID of that button itself, but just the ID of the toggle command.
So to answer your question beforehand, I have no glue if this increment search button itself has a own ID to get its state.
.October 31, 2013 at 1:36 am #17412
And BTW, this too doesn’t work for me:
//Sets the focus to the Find toolbar editor.ExecuteCommandByID(4565);
The focus is still on document.
Sets the focus to the Find toolbar works for me only
– by utilizing a keyboard shortcut or
– by All Commands: Search > Set Focus to Find Toolbar
Tested with 13.0.6 portable
.October 31, 2013 at 6:40 am #17413Bill_StewartParticipant
Right, I forgot to include the line that declares EEID_FINDBAR_INCREMENTAL in my code. The code should be:
var EEID_FINDBAR_INCREMENTAL = 4571; var eeStatus = editor.QueryStatusByID(EEID_FINDBAR_INCREMENTAL); alert(eeStatus);
What I am saying is that QueryStatusByID(4571) always returns 2 regardless of the state of the incremental search button.
I am using 13.0.6, x64 version.
- You must be logged in to reply to this topic.