Pressing two keyboard keys simultaneously (not in order) - pyautogui

I am trying to get pyautogui to press two keyboard keys at the SAME TIME(not in order). Is this possible?
I can't find anything in the documentation and have tried (press, up/down, and hotkey) with multiple syntaxes to no avail.
# Press and delay release of MP to start a song (This section can be removed if using for lvl 5 only
pyautogui.keyDown('i')
pyautogui.time.sleep(1)
pyautogui.keyUp('i')
# Start the song.
pyautogui.keyDown('o')
pyautogui.keyUp('o')
pyautogui.hotkey('i', 'o') <<<issue here, need to press 'io'.

Related

Why is type not exiting correctly?

I am trying get Sikuli to open a chat window in a game(using t) and then close it without typing anything in (using enter).
But when I run the script Sikulu opens the menu and then types tt, then it closes the menu.
I put a delay of 1 second in between the type t and type enter in case it was running too fast but it did not help.
while True:
type("t")
sleep (1)
type(Key.ENTER)
I don't understand why are you running this in a loop. If you want to perform 2 actions:
Open chat (by hitting "t")
Close chat (by hitting "t")
Just do it outside the loop, simply like this:
type("t")
#some delay to ensure the menu has opened
type("t")
The proper way to do that though is to implicitly wait for the menu to appear. So if you can define a pattern that you can use as a reliable indicator, use it like this:
type("t")
wait(pattern, waitTime)
type("t")

solr highlighting not working for long words

I am using Solr 6.2. I want to get the matched words by using highlight option.
When I search with the word "miss" I can get the highlights. But I cant get results for the word "missing".
For Example:
when I search with "miss" I can get the below results:
http://localhost:8983/solr/logbook1/select?debugQuery=on&defType=dismax&defType=edismax&hl.fl=*&hl=on&indent=on&q=miss&rows=5&wt=json
highlighting":{
"3246a347-874a-44e2-bb3d-949a358f435d":{
"String1":["IN REFERENCE CABIN LOG PAGE 22838. TWO EXTENSION SEAT BELT <em>MISS</em> ING"]},
"46a340f8-949f-41fe-b2ee-c1936bfc6b4f":{
"String1":["IN REFERENCE CABIN LOG PAGE 22838. TWO EXTENSION SEAT BELT <em>MISS</em> ING"]},
"df6eef1c-971d-48f7-a93a-07874011ae5b":{
"String1":["ACCESS PANEL 343EB ON R/H HORIZONTAL STAB FOUND WITH SCREW <em>MISS</em> ING AND LOOSE"]},
"9a124f6d-f32b-4e24-beb2-11f7aa22894d":{
"String1":["AFT GALLEY # 4 COFFEE MAKER SHIELDS ON COMPT 419 - 420 ARE <em>MISS</em> ING."]}},
When I search with missing, I am getting no result as below:
http://localhost:8983/solr/logbook1/select?debugQuery=on&defType=dismax&defType=edismax&hl.fl=*&hl=on&indent=on&q=missing&rows=5&wt=json
"highlighting":{
"0d2963a7-adea-40ab-af0a-bb8fe069c4d9":{},
"9f23f4c0-6989-471d-8c61-4016a8e38813":{},
"c77b6be1-547c-43fe-94f0-ae5c0849eab4":{},
"f5792594-7fd2-42b5-92c4-03257c05adba":{},
"68d9251a-74d9-409e-84ec-a67a0eb94866":{}},
I have checked the fragsize options. Please guide is there anything to configure.
1) So i assume you already of lowercase filter on your index field as it will fetch upper and lower case results.
2) And have you added extra space between miss + ing ? if yes you need to remove that and have a try.
3) Please check stop word dictionary if you haven't accidentally added missing there as they get ignored in searching.
4)Try Analyzer from solr to see how to transforms your search term, analyzer is available in solrconsole.
Have you set indexed and stored to true?
For me it looks like, that there are probably different setting for token-handling on indexing and search time. Take a look at your schema.xml an try to work with same settings for indexing and searching.

How do I use a function from one lisp file to solve for something in another lisp file?

I'm new to lisp and my professor gave some .lisp files to play around with.
http://pastebin.com/eDPUmTa1 (search functions)
http://pastebin.com/xuxgeeaM (water jug problem saved as waterjug.lisp)
The problem is I don't know how to implement running functions from one file to solve problems from another. The most I've done is compiled functions from one file and played around with it in the terminal. I'm not sure how to load 2 files in this IDE as well as how I should run the function. I'm trying, for example, to run the breadth-first-search function to solve the problem to no avail.
I'm currently using emacs as the text editor SBCL as the common lisp implementation along with quicklisp and slime.
Assuming each file is in its own buffer, say f1.lisp and f2.lisp, then you only have to call slime-compile-and-load-file when you are in each buffer. This is bound by default to C-c C-k. You have to compile the first file first, because it contains definitions for the second one.
But, your second file (f2.lisp) has two problems: search for (break and (bread and remove those strings. Check if the forms around them have their parenthesis well balanced.
Take care of warning messages and errors while compiling your file.
Then, if you want to evaluate something directly from the buffer, put your cursor (the point) after the form you want to evaluate, and type C-x C-e (imagine the cursor is represented by % below):
(dump-5 (start-state *water-jug*))%
This will print the result in the minibuffer, in your case something like #<JUG-STATE {1004B61A63}>, which represents an instance of the JUG-STATE class. Keep a window open to the REPL buffer in case the functions write something to standard output (this is the case with the (describe ...) expression below).
If instead you do C-c I, this will ask you which expression you want to inspect, already filled with the form before the point. When you press enter, the inspector buffer will show up:
#<JUG-STATE {1004BD8F53}>
--------------------
Class: #<STANDARD-CLASS COMMON-LISP-USER::JUG-STATE>
--------------------
Group slots by inheritance [ ]
Sort slots alphabetically [X]
All Slots:
[ ] FIVE = 0
[ ] TWO = 2
[set value] [make unbound]
Read http://www.cliki.net/slime-howto.

How to apply keyDown in Sikuli for common key

I need Sikuli to hold a common key f but can't figure out how to do this.
keyDown(Key.F)
keyDown("f")
Doesn't work and tutorials are only about functional keys Ctrs, Shift.
But how to hold a common key?
You can use any key the same way you use functional keys. You can test it by trying the below code while your cursor is located in some text area and you will see that it performs "Select all" (Ctrl+a)
keyDown(Key.CTRL)
keyDown("a")
EDIT
If you want to repeat a key, try something like that:
for i in range(n):
type("a")
where n is the number of times you want to type the letter
The Windows OS, and maybe others, interprets two or three subsequent calls to the same keyDown as holding a key down.
keyDown("f")
keyDown("f")
keyDown("f")
To simulate a SELECT ALL, do this in SikuliX:
type("a", Key.CTRL)
Here is another way (older way):
type("a", KEY_CTRL)
Beware: There is a bug, where, for some computers, the NUM LOCK has to be turned off for the special CTRL commands to work.
Hope this helps!

How do I emulate a keypress inside a Vim function?

I'll start with code
function BigScrollUp()
let count = 20
while count > 0
"Press" CTRL-Y <-- how do I emulate this?
sleep 5m
count -= 1
endwhile
endfunction
I want to create a function to quickly scroll up and down, with animation so that I can keep track of where I am going.
You can use feedkeys(). Type :help feedkeys to read more:
feedkeys({string} [, {mode}]) *feedkeys()*
Characters in {string} are queued for processing as if they
come from a mapping or were typed by the user. They are added
to the end of the typeahead buffer, thus if a mapping is still
being executed these characters come after them.
The function does not wait for processing of keys contained in
{string}.
To include special keys into {string}, use double-quotes
and "\..." notation |expr-quote|. For example,
feedkeys("\<CR>") simulates pressing of the <Enter> key. But
feedkeys('\<CR>') pushes 5 characters.
If {mode} is absent, keys are remapped.
{mode} is a String, which can contain these character flags:
'm' Remap keys. This is default.
'n' Do not remap keys.
't' Handle keys as if typed; otherwise they are handled as
if coming from a mapping. This matters for undo,
opening folds, etc.
Return value is always 0.
call feedkeys("\<C-Y>")
Try this:
" Press CTRL-Y:
normal <Ctrl+v><Ctrl+y>
Literally type ctrl+v, followed by ctrl+y which will result in a single character shown as ^Y in your script.