SendKeys Keyboard.SendKeysDelay property not working - coded-ui-tests

I have code that uses sendkeys from Microsoft.VisualStudio.TestTools.UITesting.Keyboard.
Here I am able to set the Sendkeysdelay property and send the text like this:
Keyboard.SendKeysDelay = 10;
Keyboard.SendKeys(textEdit, Constants.BackspaceString, ModifierKeys.None);
Keyboard.SendKeys(textEdit, text, ModifierKeys.None);
The result is too slow, and I would like to speed it up. Is this possible, it seems like the SendKeysDelay property does nothing.

My experiments with Sendkeys found the minimum delay was 10ms. Some delay is needed to provide time for the application to process each keypress.
If you want to enter large amounts of text then putting it into the clipboard and then using a paste command can be much quicker. The paste can often be created by recording a control-V key-press or the paste command from a menu.

Related

Reprint a table in js terminal without a waterfall print or clearing console

JS has this great feature called console.table. It allows a list of objects to be displayed as a table.
Now I could like to create a simple little program that continously displays the same table just with updated values (individual values change very fast, so a re render only on change isn't an option)
So far I got the best results simply rendering one table after the other, which leaves the most recent table always at the bottom. The problem with this is that it fills the entire terminal extremely fast and as such makes scrolling back up difficult.
Another option would be to clear the terminal and the print the table again. But this leads to excessive "blinking" which makes the table unreadable.
So basically I would need a way to print the console.table, somehow get the terminal cursor back to the start of a table and the overwrite it, similar to how it works in a lot of terminal programms like htop. Is there a way to do this in node js?

Script to paste a specific string into a text field with a hotkey

I am trying to find a way to paste a predefined string upon entering a specific keyboard sequence, on any app.
For example if I have to paste an url or a password into a field, I can have said password in a hidden script and when I press, say, [ctrl] + [5], it would write "example123" on the text field where my cursor is.
Ideally without copying to the clipboard (I'd prefer keeping what I have on my clipboard and also avoiding to paste a password or such by mistake elsewhere).
I have tried every solution I've found so far that include xclip, xdotool and xvkdb. All of them either do not work or are really inconsistent: They only paste the string sometimes, and when they do, it's usually only part of the string ("ample123" instead of "example123").
I thought of using compose key, which I heavily use anyway to write in french on an us keyboard, but it seems it only supports 1 character sequences, as nothing is printed when I modify my .XCompose to include custom output sequences of len > 1.
I am using Ubuntu 18.04 with Gnome as a DE. Ideally something that also works when logging back (like compose keys).
You need to walk the Document Object Model for either Gnome or your web-page. My concern is that with a desktop script you wont be able to access the web page because you will need to be able to establish a target to send string to. I see in your question that you tried using using "x{tool-name}" to grab the text field element. Delivering the sting really isn't the problem. The problem is getting the GUI element of text box pragmatically. The easiest way to get access to this in a user loaded web-page is with WebExtensions API which is how to make extensions for most modern browsers. Otherwise, if you can get away with only having access to Gnome's GUI I would try LDTP, it's a library used for testing, but it looks like it can be used for automation too.
For keyboard shortcuts:
It really shouldn't matter what the script is doing to how you want to activate it. I would just go to Gnome/Settings/Keyboard and set the path to where I saved the script to be the Command. If you go the WebExtension route, you will want to build the shortcut into your extension.

any programming ways to save variable of program in linux?

I only have one machine and want to save some variable values like a = 3 in linux. I can resume the last progress if power-off suddently happens.
I can only figure out two ways, one is to save in files and the other one is save to DB.
Are there any special ways to do like this without saving in files or db? any programming language is ok.
I guess there is some confusion. Do you want to save the state of your program? If so then use text editor which saves your progress even if you don't save it using ctrl+s, like sublime or gedit. Otherwise please elaborate more on what you want.

Sublime text multiple cursors?

Sublime Text is so damn advanced and this seems like such a stupid question, but...
I started writing a for loop in PHP (using SFTP), loved that it gave me a choice to auto-generate the loop. However, it enters this weird multi-cursor mode, which
1)I am not really sure how to use/exit without using the mouse;
2) it seems useless, seeing as all 3 type the same thing, even though I need to change, for example, the $i > x or $i = x.
Although Sublime does indeed support the idea of multiple cursors (which is an incredible time saver and useful as all get out, as we're about to see), what you're actually asking about here is a snippet which in this case happens to also include multiple cursors.
The general idea is that for code that you're likely to type many times (e.g. a for loop), you can create a snippet that will generate the bulk of the text for you in one shot, and then allow you to easily customize it as needed. In this case, the snippet in question is part of the default functionality of Sublime and is provided by the shipped PHP package.
To answer point #2 in your question first, this is far from useless. As seen here, I enter the text for and then press Tab to expand the snippet out. The first thing to notice here is that the status line says Field 1 of 4 to tell me that I'm in a snippet and that it contains four fields.
The first field is the name of the control variable for the loop, and all of them are selected so that as I change the name, all of them change at the same time because when there are multiple cursors, the text you type appears at all of them at the same time.
Once I'm done changing the name of the variable, I press Tab again to go to the next field, which allows me to easily change the point at which the loop starts. Another press of Tab takes me to the third field, where I can specify where the loop ends.
One last press of Tab exits the snippet and selects the text in the loop, so I can start writing my code (caveat: I am not a PHP developer).
At this point you can see Sublime offering another snippet for echo, which would expand out to an echo statement complete with quotes, then allow me to edit the text in the echo and skip to the end.
Circling back around to the first point in your question, you can use Esc at any point to jump out of a snippet and go back to regular editing. You can also use Tab or Shift+Tab to move through the fields in the snippet, and pressing Tab at the last field in the snippet exits it as well.
In this particular case, the first field in the snippet sets up multiple cursors, and so exiting the snippet while this field is active leaves multiple cursors in effect. You can jump back to a single cursor by pressing Esc one more time (this is true regardless of how you ended up with multiple cursors).

Overwritting Cut / Copy / Paste to wx.TextCtrl

So I'm learning wxPython and to do so I'm working on a text editor. I know that I can intercept a CUT / COPY / PASTE signal generated from a control, such as wx.TextCtrl by binding the equivalent wx.EVT_TEXT_COPY / wx.EVT_TEXT_PASTE / wx.EVT_TEXT_CUT. What I'm having trouble figuring out is how to override say a paste to the clipboard with other text.
For instance I have a wx.ListBox where a user can store clips of text and then select them latter to paste onto the wx.TextCtrl instead of whatever text is on the system clipboard. So basically I'm trying to intercept the paste signal and in lieu of pasting the system clipboard text have it paste the selected line from the wx.ListBox. Is this possible? If so, how would I go about doing this?
A simple solution is not to use Skip() in your wx.EVT_TEXT_PASTE handler and update control manually, e.g:
textCtrl.Bind(wx.EVT_TEXT_PASTE, self.onPaste)
def onPaste(self, evt):
#do not use evt.Skip()
print "PASTE but nothing happens"
#do some manual update of the control
The evt.Skip() would cause to propagate the event and execute default behaviour which pastes content. Without the call you block the propagation and you are able to replace the default behaviour.

Resources