I have this script, when I press Ctrl+Win+Z it runs a Paste (Ctrl+V), then if ScrollLock is enabled it flushes Clipboard, deleting the content I just pasted.
^#A::
Send ^v
if GetKeyState("ScrollLock", "T"){
Clipboard =
}
Return
Now I wanna bind this command to Ctrl+V itself. But when I do so, I receive a dialog saying that "71 hotkeys have been received in the last 1092ms" and asking if I wanna continue.
I believe it's recursiving on itself. Every Send ^v triggers the command again.
How can I do that work? I don't want the clear clipboard to be in another shortcut, because I might forget to use this other shortcut and use Ctrl+V instead. I wanna use standard Ctrl+V for pasting and ScrollLock to set when clipboard should be flushed after it.
The $ prefix prevents hotkeys from triggering themselves:
$^v:: ; ....
Related
When a command is executed, the command is saved to history. Is there an option in zsh which automatically save the commands interrupted by Ctrl-C to history?
If you mainly want to put a command back and run another first, I would suggest using the push-line widget, which is made just for that. It puts the current command on hold and clears the command line. After running another command, the original command is automatically restored. If you want to run multiple commands, you can repeat the process. As it works on a stack, you can even put multiple commands on hold. They will be restored in reverse order.
From the zshzle(1) manpage:
push-line (^Q ESC-Q ESC-q) (unbound) (unbound)
Push the current buffer onto the buffer stack and clear the buffer. Next time the editor starts up, the buffer will be popped off the top of the buffer stack and loaded into the editing buffer.
As you can see, by default it is bound in emacs mode (bindkey -e) to ^[q, ^[Q and ^Q. That is Alt+q (or Esc, q), Alt+Shift+q (or Esc, Shift+q) and Ctrl+q. The last of which only works if the option FLOW_CONTROL is disabled (setopt noflowcontrol).
There is also the push-line-or-edit widget. It behaves the same on a primary (PS1) prompt. But on a secondary (PS2) prompt it makes the whole multi-line construct (not just the current line) editable. Just like when you pull a multi-line construct from history.
I try to download file using Autoit from Firefox 28.0.
I try to download a exe file,popup flashed but autoit window info tool cannot recognize the save button.
how can i automate this.
My scripts looks like
Local $hWnd=WinActivate("[CLASS:MozillaDialogClass]")
WinWaitActive($hWnd)
;MsgBox(1,$hWnd,$hWnd)
;ControlClick($hWnd,"","Save")
ControlClick($hWnd,"&Save File","")
;WinClose("[CLASS:MozillaDialogClass]")
how can i automate this......
Right now both of your ControlClick attempts are incorrect. The correct syntax is ControlClick(Window title or handle, *window* text, control *id*, ...). Look at the helpfile and examples for it to see what you're not doing right currently.
The firefox download dialog is a little tricky, googling gives a lot of results for people who have tried to do the same thing and struggled.
The easiest method is to click the window at the coordinates of the button. ControlClick can be used for this (simply leave the control id blank). The AutoIt window info tool should give ControlClick coords when you try and select where the button is.
That method does assume that the button is always in the same place, which is not necessarily the case. Alternatives are to use ControlSend to send the Alt+S combination (or whatever it is for that button).
And finally, it's worth mentioning the IUIAutomation framework which has shown to be very reliable for automating windows that aren't using standard winapi controls.
The simplest way to do is as follows on mozilla:
Use the following code on autoit.au3 file
ControlFocus ( "MozillaDialogClass", "", "" )
Sleep(10)
Send("{ENTER}")
Execute the same file in selenium using:
Runtime.getRuntime().exec("C:\\Users\\Balaji\\Desktop\\autoit.exe");
Use the below code to download a file in Firefox using AutoIt.
WinWait("[TITLE:Opening ; CLASS:MozillaDialogClass]","", 10)
If WinExists("[TITLE:Opening ; CLASS:MozillaDialogClass]") Then
; Perform keyboard ALT key + s key to select Save File Radio button using keyboard shortcut.
ControlFocus ( "[TITLE:Opening ; CLASS:MozillaDialogClass]","", "" )
Send("!s")
; Wait for 2 seconds
Sleep(2000)
; Press Keyboard ENTER button.
Send("{ENTER}")
EndIf
My .zshrc file contains the line
bindkey -v
I'm attempting to bind ^q or \M-q to push-line, e.g.
bindkey "^q" push-line
but for some reason it isn't working.
Running `bind key -v' confirms
"^Q" push-line
But it doesn't actually do anything. Other control- mappings, such as ^r, work fine.
I can successfully map "push-line" to "\eq", but I don't like this behavior. First of all, I never use esc- type bindings, and secondly doing so binds it to control, meta, and escape, which is overkill. (Incidentally, shouldn't it only bind all of them like that with `bindkey -m'? I never set that in my .zshrc?)
So, anybody have any idea what's going on here?
These shortcuts are used by Software flow control (wikipedia)
Ctrl+S and Ctrl+Q are used to stop and resume the output of a program.
To try it:
Run while (true) ; do echo $RANDOM ; sleep 1 ; done
Press Ctrl+S, the output stop.
Press Ctrl+Q, the output resume.
(I'm not sure the program is stopped like with Ctrl+Z, i think it is stuck by lack of outputting. Ctrl+C to kill the program.)
These shortcuts take over your shortcuts, but if you disable this flow control feature, it could work.
You can learn how to disable it in How to unfreeze after accidentally pressing Ctrl-S in a terminal? - Unix and Linux.
Try it and tell us.
I am using an AutoIt script to automate my application. Following is the command which I am running:
FileOpenDialog ("File Upload", "C:\Documents and Settings\abhishek.kumar\Desktop\Quadrillion work", "Images (*.jpg;*.bmp)", "","WESTF12433.jpg","" )
Send("{ENTER}")
The first command works as it opens up the file open dialog with WESTF12433.jpg file as selected. Now I want to click on open button. How can I do it?
Send("{ENTER}") is not working.
Send is not a good method as it requires the window to be focused, which you can't guarantee. From what you have posted, I would say the best method would be this:
ControlClick("File Upload", "", "Button1")
Edit in response to comments:
Your problem: The fileOpenDialog is blocking execution. You need to think of it as though AutoIt Reads a line, Runs it, then reads the next.
In this case: AutoIt Reads line 1. It creates a FileOpenDialog and WAITS for you to close it. Once it as been closed it reads the next line, and runs that.
Try the following: Create two au3 files, and put the first line in 1.au3 and the second in 2.au3. Run them in that order and see what happens. Send will struggle as the dialog doesn't have focus, but the ControlClick versions should work.
You're not using FileOpenDialog() properly. Its purpose is to interact with the user. If you don't need that, there's no need for it in the first place.
All it does is return the name(s) of the selected files, which you defined already. Can't you just assign the file path to the variable from the start? As per Documentation - Function Reference - FileOpenDialog() :
Success: Returns the full path of the file(s) chosen. Results for
multiple selections are "Directory|file1|file2|..."
This will never work, because AutoIt is not multi-threaded.
Once you open the dialog, it pauses script execution until the user clicks ok, so a Send() function on the next line won't do anything until after.
What you can do is make another script, compile it, and run it just before you open the dialog.
Run("clickOpen.exe")
FileOpenDialog ("File Upload", "C:\Documents and Settings\abhishek.kumar\Desktop\Quadrillion work", "Images (*.jpg;*.bmp)", "","WESTF12433.jpg","" )
This is what would get executed:
WinWaitActive("File Upload")
Send("{ENTER}")
Simple as that! Hope it helps.
Im just curious if im viewing a file e.g. x.log which is currently being updated ie a log file. Is there a way to effectively refresh it rather than :q and vim x.log it again ?
The command :e with no parameters will do that.
:edit with no other parameters will reload the current file.
:edit! to discard changes first.
Also gvim will prompt you to reload a file if you switch to another program and back, and it detects that the file has changed.
Also you can do
:set autoread
if you are just viewing the file without changing it.
:e reloads the current file. Use :e! if you made any changes. You can assign a key to it like this:
nmap <F1> :e^M
Where ^M is a literal control-M (use control-V in vi).