Insert text with hotkey combination

Using applications, configuring, problems
Message
Author
Bushbuck
Posts: 179
Joined: Sat 26 Jan 2013, 01:33

#21 Post by Bushbuck »

MochiMoppel wrote:I suspected a timing problem and created a second icon, this time with a 1 sec delay before executing xdotool. This time the keyboard shortcut worked.
I wanted it to "type" a frequently-used message into an edit-box in the browser (Pale Moon) when the 'media' key was pressed.

My first attempt dropped the first few characters (unpredictably).

Current version is

Code: Select all

#!/bin/sh
sleep 0.2
xdotool type --delay 100 'frequently used message'
and works reliably. I'm sure the inter-key delay could be much smaller, and still work OK.
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#22 Post by MochiMoppel »

Bushbuck wrote: I'm sure the inter-key delay could be much smaller, and still work OK.
I'm sure the inter-key delay makes no difference. It's your sleep command that makes it work. But how much sleep xdotool needs depends on the application it is used on and probably also on the processor speed. Using the same makro on a different machine may give different results.

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#23 Post by Puppus Dogfellow »

MochiMoppel wrote:Puppus, since you are an xdotool expert you may have an idea how to make this tool stable. More than once I get unpredictable results. Example: I made a desktop icon (left in the screenshot) and assigned it Ctrl+Shift+F11 as keyboard shortcut. The icon works nicely when I activate Geany and click on it. However the keyboard shortcut doesn't work. I suspected a timing problem and created a second icon, this time with a 1 sec delay before executing xdotool. This time the keyboard shortcut worked. Reducing the sleep command to something like 0.5 sec. triggers Geany's Replace dialog. Totally unexpected.
the program can do much more than what i use it for--i'm no expert. that said, and looking at what bushbuck has brought and your reply, i can play around and read the documentation or comments later after some sleep if i can't get something similar to work (i'd probably have been content to give up on it had i not seen this post). i have a set of four launchers i use to access a folder off PATH--i changed it around a bit so that it preloads either the folder, rox space folder, geany space folder, or leafpad space folder, all with the text highlighted. i usually add an xdotool script to right arrow past it all to the end of the folder's path, and it always worked on this machine with a .2 second delay, but now, with these basically unchanged launchers being activated from .desktop files in another folder on the same partition, no delay as high as a second seems to work. switching bash for dash seems to have no effect on anything...the code (same modified pexec) got shorter, if that affects speed :roll:
:

Code: Select all

#!/bin/sh


CMDLINE=$(yad --width=350 --skip-taskbar --center --on-top --fixed --sticky \
              --title="pw,n-g" --window-icon="gtk-execute" \
              --entry --entry-label="Run command:"  \
              --column="command" --entry-text "geany /nwp/")

# if the command line is empty, exit now
[ -z "$CMDLINE" ] && exit 0

 

# run the command
$CMDLINE &

exit 0
i could go back and try new sleeps or the delay deal (new to me--more evidence (if any were needed) of my falling short of expert :( :) ), maybe try the original mod's xdotool add on as a desktop file to see if that stops it from working correctly...

will check in when i can see straight.

...there's a weird bug with palemoon with the forum--the editing box gets all wavy and weird when the cursor is moved then reset...pretty sure it's not sleep related....

just remembered, on one machine, bad timing settings push random clickable scripts in the aforementioned folder (generally hop windows around the screen). sounds kind of related to your problem, Mochi.

Bushbuck
Posts: 179
Joined: Sat 26 Jan 2013, 01:33

#24 Post by Bushbuck »

MochiMoppel wrote:I'm sure the inter-key delay makes no difference. It's your sleep command that makes it work. But how much sleep xdotool needs depends on the application it is used on and probably also on the processor speed. Using the same makro on a different machine may give different results.
I tried removing the inter-key delay completely, and it intermittently dropped the final character in the string. Weird.

--delay 10 was still unreliable.
--delay 20 seems to be OK.
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.

Bushbuck
Posts: 179
Joined: Sat 26 Jan 2013, 01:33

#25 Post by Bushbuck »

Puppus Dogfellow wrote: ...there's a weird bug with palemoon with the forum--the editing box gets all wavy and weird when the cursor is moved then reset...pretty sure it's not sleep related....
I get that too (PM 24.7). My guess was bad font rendering in the video driver, but my attempt to use the nvidia one didn't work out.

If you highlight the mangled text in the edit box, it makes it readable again. :lol:
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#26 Post by MochiMoppel »

Bushbuck wrote:I tried removing the inter-key delay completely
<snip>
--delay 10 was still unreliable.
Well, that shouldn't be a surprise then. The default is 12ms :wink:

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#27 Post by scientist »

I do not have at1 nor can I find it.

I did not see a string in your example.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

regarding the mysterious location of at1

#28 Post by Puppus Dogfellow »

scientist wrote:I have got xdotool to run.

How would I assign 'test' to Shift F11 ?

Code: Select all

# <Key mask="SAC" key="S">exec:at1</Key> 
bash: syntax error near unexpected token `newline'
<ec:xdotool type 'long, forgettable thing or string'</K
scientist wrote:
I do not have at1 nor can I find it.

I did not see a string in your example.
it's on the lower shelf, right above ethel the aardvark goes quantity surveying.

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#29 Post by scientist »

It is chopping off some text.
Attachments
Untitled.png
(162.91 KiB) Downloaded 121 times
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

#30 Post by scientist »

Looks like this topic should be marked as unsolvable.

In doing some research, it looks there are conflicts with some key combinations that are reserved.

Is there a list of those ?
Last edited by scientist on Fri 04 Sep 2015, 02:00, edited 1 time in total.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#31 Post by Semme »

More like, incomprehensible. Read-up Champ >> http://catb.org/~esr/faqs/smart-questions.html#explicit

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#32 Post by MochiMoppel »

Here is another innovative (?) way. No guarantees, but it seems to reduce the timing dilemma and frustrating text cuts.

Try Parcellite actions. They are designed to use clipboard content to perform actions, but can be used without using the clipboard. In my example I prepared 2 text templates to be typed by xdotool.

The default hotkey for the little action menu is Ctrl+Alt+A. Select the desired text block from the list (The "Hello" in the example is the current clipboard content. Has no meaning here). The charming point of this solution is the ability to create multiple text blocks, all with an identifier name, which can easily be edited and don't need their own keyboard shortcut.
Attachments
parcellite_actions.png
(32.56 KiB) Downloaded 216 times

Bushbuck
Posts: 179
Joined: Sat 26 Jan 2013, 01:33

#33 Post by Bushbuck »

MochiMoppel wrote: Try Parcellite actions.
<snip>
The default hotkey for the little action menu is Ctrl+Alt+A.
Have used Puppy for years, and had no idea that you could do that!
Thanks, MochiMoppel. :D
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.

User avatar
sickpig
Posts: 25
Joined: Mon 31 Dec 2018, 10:53
Location: NSW

#34 Post by sickpig »

Thanks a bunch MochiMoppel

this post is way too underrated in google seo

I was looking for an alternative to autohotkey(windows) to expand abbreviations
the options i discovered were not up to the mark
thought about running wine
but that defeats the purpose
i dont want to bloat the system by running anything additional than essential
now your post just sort the issue doesnt it
btw it works with clipit too the default clipboard manager for xx7.5.64
fantastic
u never know how much you can learn and implement by scouring this forum
the wealth of knowledge is immense
thanks heaps

Post Reply