10-28-2017, 07:18 PM
Hello All
I find I am always having to manually type out this out statement for logging various variable values in my code:
-->
I have thought there must be an easier way, like passing to a function to format and repaste - the problem is that this function OutVar doesn't work in exe. See below
So I rewrote it as a triggered function in QM editor. Two versions - one which is triggered by Double Right Click anywhere in variable name. Other triggered by keyboard command eg. WinP
Note that this is very fast as you don't have to select the variable, only have your cursor somewhere in the variable name characters. It will expand out to word boundaries and make new line for the output statement without breaking up even very long line of code.
Note however, this simplified super quick method only works for simple variable names. If the variable is part of an string or int ARRAY (eg. arrSampleArray[0 9] or is a member of a custome variable type eg. TYPE SampleType x.SampleMember, then you can still use this function. You will just have to select out entire variable, and then do same trigger. If will test if there is any selection and if not, select out to word border. If yes, then it will just go with the selection.
I couldn't figure out a way to add a trigger on to the QM RightClick Menu, similar to adding to Shell Menu. Is it possible?
Here is the code:
Function FStringOutFormat_KbTrigger
Trigger Wp /QM
Function FStringOutFormat_DouRClickTrigger
Trigger ##R /QM
I hope this is helpful for others. Or if there is much easier way already available, let me know!
Thanks,
S
I find I am always having to manually type out this out statement for logging various variable values in my code:
str SampleVar = "Test"
str FuncName.getmacro(getopt(itemid 3) 1)
out F"[FuncMacro: {FuncName}]: SampleVar: '{SampleVar}'"
-->
Quote:[FuncMacro: Macro121]: SampleVar: 'Test'
I have thought there must be an easier way, like passing to a function to format and repaste - the problem is that this function OutVar doesn't work in exe. See below
- http://www.quickmacros.com/forum/showthr...p?tid=4657
http://www.quickmacros.com/forum/showthr...p?tid=3423
So I rewrote it as a triggered function in QM editor. Two versions - one which is triggered by Double Right Click anywhere in variable name. Other triggered by keyboard command eg. WinP
Note that this is very fast as you don't have to select the variable, only have your cursor somewhere in the variable name characters. It will expand out to word boundaries and make new line for the output statement without breaking up even very long line of code.
Note however, this simplified super quick method only works for simple variable names. If the variable is part of an string or int ARRAY (eg. arrSampleArray[0 9] or is a member of a custome variable type eg. TYPE SampleType x.SampleMember, then you can still use this function. You will just have to select out entire variable, and then do same trigger. If will test if there is any selection and if not, select out to word border. If yes, then it will just go with the selection.
I couldn't figure out a way to add a trigger on to the QM RightClick Menu, similar to adding to Shell Menu. Is it possible?
Here is the code:
Function FStringOutFormat_KbTrigger
Trigger Wp /QM
str VarName.getsel
if empty(VarName)
,dou
,VarName.getsel(0 0 child);;focused control,
key EDHYU;;moves to next line, create new line for paste
str QuotationMarks = "''"
QMITEM q
qmitem("" 1 &q 1)
str OutFormat = F"out F{QuotationMarks}[FuncMacro: {q.name}]: {VarName} = '{{{VarName}}'{QuotationMarks}"
paste OutFormat
Trigger ##R /QM
key Z ;; Esc;;gets rid of Edit popup menu in QM Editor
str VarName.getsel
if empty(VarName)
,dou
,VarName.getsel(0 0 child);;focused control,
key EDHYU;;moves to next line, create new line for paste
str QuotationMarks = "''"
QMITEM q
qmitem("" 1 &q 1)
str OutFormat = F"out F{QuotationMarks}[FuncMacro: {q.name}]: {VarName} = '{{{VarName}}'{QuotationMarks}"
paste OutFormat
I hope this is helpful for others. Or if there is much easier way already available, let me know!
Thanks,
S