Closed Avastgard closed 1 year ago
Yup. If you are using the Excel spreadsheet to manage your commands, find the o
(or edit in LNCHR-commands.ahk directly. The code in here executes as soon as the space is typed, so you can change the value of the edit box with lngui._edit.Value := 'categories:="blue"'
.
The OutlookSearch function in LNCHR-Funcs.ahk is executed (with input argument equal to the textbox) after you press enter. You can instead modify the string and append 'categories:="blue"'` here, and send your hotkeys to change windows.
Thanks for the answer.
However, I can't seem to get this to work. LNCHR-Commands.ahk
does not contain the line lngui._edit.Value
. I only found it inside LNCHR-Funcs.ahk
, and it seems to be related to the calculator:
run_calc_shortcut_then_return(s){
tryrun(s)
lngui._edit.Value := ""
Sleep(200)
WinActivate(lngui.Hwnd)
return
}
Even so, editing lngui._edit.Value := ""
to lngui._edit.Value :="categories="blue""
had no effect on the outlook search.
Also, I don't understand how the spreadsheet works. Is it supposed to append lines to the script?
Just becase LNCHR-Commands.ahk doesn't have that line, does not mean it cannot access it. lngui
is an object (i.e. the main gui object) and objects have global scope in v2. lngui._edit
is the edit (input) text box object, and lngui._edit.Value
is the value of the input textbox (it doesn't matter what state the gui is in), which can be used to get or set the text as a string. I commented this in LNCHR-Main.ahk.
In a later revision I will have set_lngui_input
and get_lngui_input
functions to make this easier.
Below works for me. Note that the lngui_enable_query
first clears the input box so lngui._edit.Value
has to be performed after.
if input == "o " ; Outlook
{
lngui_enable_query("Outlook", OutlookSearch)
lngui._edit.Value := 'categories:="blue"'
return
}
The spreadsheet is a tool that creates the LNCHR-Commands.ahk file. I find it easier to manage commands in the spreadsheet than edit a 600+ lines text file. It generates the LNCHR-Commands.ahk from scratch and does not append. So you have to make the choice if you want to use the spreadsheet or edit the text file.
I tried this and it worked as far as having the words categories:="blue"
displayed on the query box.
However, pressing enter just searches outlook for "o ", so for some reason the words categories:="blue"
are not being read. Cutting and pasting this text on the query box and pressing enter worked, so perhaps what I need is a way to Send
text to the query box, as if it was being typed? Does that make any sense?
I tried
if input == "o " ; Outlook
{
lngui_enable_query("Outlook", OutlookSearch)
Send, categories:="blue"
return
}
But it throws me this error:
Error: Function calls require a space or "(". Use comma only between parameters.
Text: Send, categories:="blue"
Line: 308
File: C:\Users\flima\AutoHotkey\LNCHR\LNCHR-pub-master\LNCHR-Commands.ahk
The script was not reloaded; the old version will remain in effect.
It works for me without a problem. Have you changed anything else in the script?
For send, you have to use the new v2 syntax, omit the comma: https://www.autohotkey.com/docs/v2/lib/Send.htm
Hi there, sorry for the late reply. I thought I had replied, but it seems I didn't post it for some reason.
What I'm trying to do is to search inside Archive for e-mails with certain categories.
I redownloaded the script from github again to make sure I was working with the original code. Here's what I tried:
In LNCHR-Commands.ahk
, I tried
if input == "o " ; Outlook
{
lngui_enable_query("Outlook", OutlookSearch)
lngui._edit.Value := 'categories:="blue"'
return
}
categories:="blue"
correctly shows up in the query box, but pressin Enter results in the script just searching outlook for "o ". It seems it doesn't recognize the text in the box.
Next, I tried in LNCHR-Commands.ahk
:
if input == "o " ; Outlook
{
lngui_enable_query("Outlook", OutlookSearch)
Send "categories:=`"blue`""
return
}
It correctly sends categories:="blue"
to the query box, but pressing Enter results in the same problem above. Cutting and pasting the text solves the problem and searches as expected.
Even if I managed to solve this issue, there are several other things I would need to address as well before the search happens:
Send "^#{Left}"
Do you have any ideas on how I could make this work?
Ahh, I found the bug (my current version has this fixed, which is why I wasn't experiencing the same issue).
Replace the lngui_edit_chng
function with this:
lngui_edit_chng(GuiCtrlObj, Info) {
if is_lngui_state("main")
lngui_run_commands(lngui._edit.Value) ;
return
}
I will update the version soon.
Like I said before: The OutlookSearch function in LNCHR-Funcs.ahk is executed (with input argument equal to the textbox) after you press enter. You would do step 1 and step 2 here first. For step 2, my knowledge on the topic is as much as yours.
Should be fixed now with latest version.
Awesome, I'll try as soon as I can.
Let me know if it works. For updating the input box, I recommend using:
set_lngui_input(' categories:="blue"')
Let me know if it works. For updating the input box, I recommend using:
set_lngui_input(' categories:="blue"')
Where should I include this line?
Wherever you would have put lngui._edit.Value := 'categories:="blue"'
.
Thanks, I managed to get this working with this:
if input == "o " ; Outlook
{
lngui_enable_query("Outlook", OutlookSearch)
set_lngui_input('categoria:=""')
Send "{End}" "{Left}" ; to move the caret inbetween the quotation marks
return
}
I will be adding a function to move the caret more easily. I'm also hoping to add some auto-complete functionality.
Great to hear that!
What interests me most in this script is the outlook search function. I search all the time, always for categories. Is there a way to change the script's behavior so that when I type "o ", the outlook query box already shows the text "category:" and I just have to type the desired category?
Also, I usually use two virtual desktops and the script throws me an error when I try to use outlook search from the second desktop and outlook is on the first one. How do I add custom Send commands (
Send, ^#{Left}
) before the script runs the query, so it is on the correct virtual desktop and finds the program? I feel this should be simple, but I'm not yet familiarized with v2.