I suggest that QM can contain a predefined variable of the mouse pointer, for example: _cursor , this function is very useful in automatic text, autohotkey has this function
In the following example, if I use this variable, after the character is entered, the mouse cursor jumps to the position of the variable.
#sub Sub1 m
_s= F ;Dear Mr. $inp_Customer$, ; ;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$. ; ;Thanks and best regards, ;$cur$ ; ;$A_ShortDate$
;Shows an auto-created dialog containing Edit and ComboBox controls specified in template text like $inp_Label$. ;Returns template text where these substrings are replaced with user input. ;Also can contain variables like $var_Name$ that are replaced by your callback function.
;REMARKS ;Special substrings: ;$inp_Label$ - creates an Edit control and static text Label. ;$sel_Label$ - creates a ComboBox control and static text Label. To get ComboBox items, calls your function named AID_sel. See examples there. ;$var_Name$ - calls your function named AID_var. See examples there. ;$set_CaretHere$ - removes and sets nLeft = the number of Left keys to move the caret (text cursor) here.
;On Cancel ends this thread.
;Example - code in function KeyAutoInputDialog. ;In scripts you'll probably use KeyAutoInputDialog, not this function. Use this function only to create functions similar to KeyAutoInputDialog, for example to use paste instead of key.
ARRAY(str) a if(!findrx(template "\$(?:inp|sel)_(.+?)\$"04 a))ret template
str r ARRAY(POINT) b findrx(template "\$(?:inp|sel)_.+?\$"04 b) int j for i 0 b.len ,POINT& p=b[0 i] ,r.geta(template j p.x-j) ,int u=0;if(template[p.x+1]='s')val(c[i+1] 0 u); u+1 ,r+c[i+1]+u ,j=p.y
r.geta(template j)
;Calls <help>AutoInputDialog</help> and types the text. Also sets caret if need.
;EXAMPLE ;_s= ;F ;;Dear Mr. $inp_Customer$, ;; ;;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$. ;; ;;Thanks and best regards, ;;$set_CaretHere$ ;; ;;$var_ShortDate$ ;; ;KeyAutoInputDialog(_s)
int nLeft str s=AutoInputDialog(template nLeft) spe10 key(s) if(nLeft)key L(#nLeft)
str s= ;Dear $sel_Call$. $inp_Customer$, ; ;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$. ; ;Our office is at $sel_Country$ ; ;Thanks and best regards, ;$set_CaretHere$ ; ;$var_ShortDate$ ; KeyAutoInputDialog s
04-07-2019, 09:10 PM (This post was last modified: 04-08-2019, 11:08 PM by win.)
Thank you very much for your help, this is a great feature,
I have encountered two problems in the test:
1. How to make the edit box support drag and drop, for example, when I drag the file onto the edit box, automatically enter the filefullpath of the file
2.I added a custom variable $var_pcname$ but after the output, there is no blank line
;Shows an auto-created dialog containing Edit and Static controls specified in template text like $inp_Label$. The Label part sets static text. ;Returns template text where these substrings are replaced with user input.
;REMARKS ;Special strings: ;$var_ShortDate$ - replaces with current date. ;$set_CaretHere$ - removes and sets nLeft = the number of Left keys to move the caret (text cursor) here.
;On Cancel ends this thread.
;Example - KeyAutoInputDialog code.
ARRAY(str) a if(!findrx(template "\$inp_(.+?)\$"04 a 1))ret template
str r ARRAY(POINT) b findrx(template "\$inp_.+?\$"04 b) int j for i 0 b.len ,POINT& p=b[0 i] ,r.geta(template j p.x-j) ,r+c[i+1] ,j=p.y
r.geta(template j)
i=find(r "$var_ShortDate$") if(i>=0) r.replace(_s.timeformat("{D}") i 15)
#sub Sub1 m
_s= F ;Dear Mr. $inp_Customer$, ; ;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$. ; ;Myfile is here "$inp_Filepath$" ; ;Thanks and best regards, ;$set_CaretHere$ ; ;pcname is $var_pcname$ ; ;$var_ShortDate$ ; KeyAutoInputDialog(_s)
I updated the code.
Now supports ComboBox controls and callback functions for replacing variables and getting ComboBox items.
With ListBox would need more work. Need to calculate height.
04-09-2019, 05:12 AM (This post was last modified: 04-09-2019, 05:39 AM by win.)
I think it is possible to add a judgment condition to the function body. If a new line is created, the tab is deleted first.
I have found this problem only in the QM editor, there is no problem in Notepad.
I very much hope that the indentation and escaping problems can be solved elegantly and thoroughly.
;Calls <help>AutoInputDialog</help> and pastes the text. Also sets caret if need.
;EXAMPLE ;_s= ;F ;;Dear Mr. $inp_Customer$, ;; ;;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$. ;; ;;Thanks and best regards, ;;$set_CaretHere$ ;; ;;$var_ShortDate$ ;; ;PasteAutoInputDialog(_s)
int nLeft str s=AutoInputDialog(template nLeft) spe10 paste s if(nLeft)key L(#nLeft)
Other option - before key insert opt keychar 1. Then some code editors, including QM, will not auto-indent when previous line is tab-indented. But still will auto-indent after lines such as 'if', 'sel', 'rep'. Better paste.
;Calls <help>AutoInputDialog</help> and pastes the text. Also sets caret if need.
;EXAMPLE ;_s= ;F ;;Dear Mr. $inp_Customer$, ;; ;;thank you for contacting us. The price is $$inp_Price$. Let's meet next $inp_Day$. ;; ;;Thanks and best regards, ;;$set_CaretHere$ ;; ;;$var_ShortDate$ ;; ;PasteAutoInputDialog(_s)
int nLeft str s=AutoInputDialog(template nLeft)
;Indirectly solve the escaping problem (replace $cel with $sel)
s.findreplace("$cel""$sel") spe10 paste s if(nLeft)key L(#nLeft)
04-11-2019, 08:24 PM (This post was last modified: 04-11-2019, 08:24 PM by win.)
As more and more items in AutoText, I need to manage them,
I need a function to implement it. Below is the schematic. When I press alt+spacebar, it will be displayed. It has no title bar.
This feature can be used under all programs, it can even manage all macros indirectly
My current level of programming is still not reaching the goal. It contains a lot of programming skills that I have never touched before, for example, displaying search results instantly when entering keywords
Although there are a lot of software that can do this, I really want to know how to implement it using QM code. Can you provide an example? thank you very much
;Automatically completes when you type in edit control. ;Call from dialog procedure, on EN_CHANGE. For grid control (edit or combo cell), call on GRID.LVN_QG_CHANGE.
;hEdit - edit control handle. ;items - list of items.
ret ;messages sel message ,caseWM_INITDIALOG ,caseWM_DESTROY ,caseWM_COMMANDgoto messages2 ret ;messages2 sel wParam ,caseCBN_EDITCHANGE<<16|3 ,CB_AutoComplete lParam ,caseIDOK ,caseIDCANCEL ret1
04-11-2019, 11:58 PM (This post was last modified: 04-12-2019, 06:30 AM by win.)
Thank you for your help, I still can't finish this function, some details don't understand
This function is very useful for managing: macros, or Autotext, and items in Autotext. If developer can add this function to the basic functions of QM, it would be great.
detailed description :
1. Press the alt+space hotkey first, the search menu will pop up.
2. Then enter the keyword and the search results will be displayed in real time.
3. If the abbreviations is repeatedly defined, the list is displayed and can be selected.
Because I can add the recorded code or macro code to the sub-process of AutoText item, so I think the above functions are much more convenient than creating toolbars, shortcuts, Hotkey, triggers, etc.
It doesn't need to remember what the hotkeys are, nor does it have to do too many settings like creating a toolbar or Set a trigger. Just press alt+spacebar when you need it, then search(Can see the description of the acronym) and click or enter.
08-29-2022, 01:22 PM (This post was last modified: 08-29-2022, 11:11 PM by Davider.)
I have a strange problem where some controls cannot use function PasteAutoInputDialog
err tip:
Error (RT) in <open ":203: /640">PasteAutoInputDialog: cannot paste. <help #IDP_ERRORS>Possible reasons. <help #IDP_ERR>?
If I use another function KeyAutoInputDialog, there is no any input