how to say what happens when you press a button in ahk? - autohotkey

how do I make an specific function happen if an specific button is pressed?
for example, there is an variable named "ef". So now, if I press ctrl+alt+;, an message box will pop up, with the buttons abort, retry and ignore. so, if I press abort, the variable "ef"‘s value will become efabort. If I press retry, it‘s value will become efretry. otherwise, if I press Ignore, ef‘s value will become efignore.
Is that possible? if yes, please leave an answer containing the code.
start with this:
ef = 000
<!<^;::
MsgBox,2,set ef,what do you want to set ef to?
Any answers? Thanks.

A variable is a placeholder for a value. The value can change, nevertheless a variable can only hold one value at a time.
To store a value in a variable is recommended to use the expression method that uses the colon-equal operator (:=).
ef := "" ; initialize the variable in the auto-execute section (top of the script)
MsgBox,2,set ef,what do you want to set ef to?
IfMsgBox Abort
ef := "efabort"
IfMsgBox Retry
ef := "efretry"
IfMsgBox Ignore
ef := "efignore"
; To return a given value of a variable within commands, you need to enclose the variable in percent signs
MsgBox % "The value in the variable ef is now " . ef . "."

Related

Eclipse - Debugging

I am very new to Selenium and Eclipse.
I have a question (actually 2 questions) about debugging.
When I am debugging in Eclipse (Version: 2021-06 (4.20.0)), so I do not get visibility of all variables I have defined in the method.
For example, (see the screen shot attached) I have added string variable testSigned and assigned a value to it. Actually the purpose is to verify the text value contained in web element table_AdditionalDocumentation.
I defined Toggle Line breakpoint at line 395.
I started to execute in debug mode, got to the line 395.
However, I do not see the value of testSigned in Variables tab.
I noticed it does show values only of the variable which would be returned by the method, correct me if I am wrong.
Please, tell me how to get those values I have defined visible.
2.Additionally, please, let me know which button to press if for example after line 395 I want not to go line by line (F6), but just to run the code to the end.
For the first question, I'm not certain, but it might be because you haven't initialized that variable with a value. Try setting it to an empty string on the declaration line.
For the second question, if you set a breakpoint on the line you want to get to, just Resume (F8), and it will stop at the next breakpoint it hits, hopefully the one at the end of your method. Alternatively, if you just want to stop at the line right after the method returns (which will show the return value), you can click "Step Out" (F7) for that.

How to set combination threshold in Autohotkey

There is a description of how to define a custom combination in AutoHotkey:
You can define a custom combination of two keys (except joystick
buttons) by using " & " between them. In the below example, you would
hold down Numpad0 then press the second key to trigger the hotkey:
Numpad0 & Numpad1::MsgBox "You pressed Numpad1 while holding down Numpad0."
Numpad0 & Numpad2::Run "Notepad"
But I couldn't find how to set the threshold. for example, I want Numpad0 & Numpad1 only to happen when user presses Numpad1 in less than 300ms after pressing Numpad0.
You could do something like this for example:
Numpad0::
if (!PressedAt)
PressedAt := A_TickCount
return
Numpad0 Up::PressedAt := 0
#If, A_TickCount - PressedAt < 300
Numpad1::MsgBox
#If
So use A_TickCount(docs) to compare times.
And the if-statement is there because of Windows' key repeat functionality. Without it, the PressedAt time would get set constantly while Numpad0 is held down.
Also, 0 is false, so we can conveniently use the PressedAt variable in the if-statement as well.
Could've also be done without a context sensitive hotkey for Numpad1, it just makes the key retain its original functionality.
If #If were to cause you trouble, you can switch over to a normal if-statement check inside the hotkey label.
And be sure to add the ~ prefix(docs) to the Numpad0 hotkey if you want.

How to inhibit 'etags completion' changes the value of 'tags-file-name'?

I'm using etags and found that:
Step 0. Set the 'tags-file-name' as buffer local to a specified TAGS file, and the global value is nil.
Step 1. Press M-. to find tags.
Step 2. Input some characters in the mini-buffer and press the TAB key for completion, then the mini-buffer will display "Making tags completion table for ...done".
After that, the global value of 'tags-file-name' is set to the same as its local value.
How can I keep the global value nil ?
This is related to a family of bugs that have been fixed in the current development tree, and available in Emacs 26 when it comes out.
Here's the closing message: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23164;msg=31

Tell Eclipse to auto-complete only method name?

Let's say I'm editing a line...
obj.fooBar(x, y, z);
I want to change the method name to fooSomethingElse, but keep most of the arguments. If I delete all or part of the name, and then use content assist, it completes the method name, but starts a new arg list...
obj.fooSomethingElse(arg1, arg2)(x, y, z)
^---- this arg is highlighted for editing
I often have to delete "(arg1, arg2)". I can turn off "fill method arguments" in preferences and then I only have to delete "()", but it's still annoying. Is there another command to complete only the method name. Ideally it would just be a separate command and key combo from the general purpose content-assist, so I can invoke either one as needed.
Essentially you are looking for a way to toggle between inserting and replacing via content assist. The default behavior is to insert. You can toggle this behavior while inside the content assist selection dialog by pressing and holding the Ctrl key while selecting the completion.
More inforation - http://blog.deepakazad.com/2012/06/jdt-tip-toggle-between-inserting-and.html
I think you just need to press tab instead of enter to autocomplete it. Then it will keep your existing parameters.

Debugging with Zend Studio / Eclipse

Is it possible to debug PHP scripts so that it keeps running until an expression is true?
For example, I want to know when $a becomes a certain value. I don't want to keep pressing step into and wait until the variable $a changes the value to it.
The solution is to set a breakpoint, right click on it and set a condition for it.
However, there are no global breakpoints, you must specify a location for every breakpoint you put. So, if you want to know where a value changes, you can't set any global conditions as they would be too CPU consuming.