Insert text with hotkey combination

Using applications, configuring, problems
Message
Author
scientist
Posts: 860
Joined: Sat 23 May 2015, 08:21

Insert text with hotkey combination

#1 Post by scientist »

Is there a way to assign a text string to a hot key combination ?
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#2 Post by bigpup »

Give example of what you want to do and in what program or what?
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

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

re: Insert text with hotkey combination

#3 Post by Puppus Dogfellow »

Code: Select all

#!/bin/sh

xdotool type ''
requires xdotool. put your text string between the single quotes. add something like

Code: Select all

<Key mask="SAC" key="S">exec:(path to your script)</Key>
/root/.jwm/jwmrc-personal. (example makes shift plus alt plus control plus the s key your hot key). if you place the script in /root/my-applications/bin or other path location (in puppy, all the /bins plus games, i think), you need only write down its name after the "exec:" bit.

anyway, the above works--will remember returns and line breaks, too.

the key command is also pretty handy.

http://www.semicomplete.com/projects/xdotool/


xdotool-2.20110530.1-3.pet]xdotool pet i've mirrored


works in every 32 bit pup, i believe, but you may want to check your PPM for a more recent version.

(been a while--can't remember the original source of the file, but i use it all the time, so thanks again...)

after you make your changes to to jwmrc-personal, restart jwm.

ebisu
Posts: 176
Joined: Wed 25 Sep 2013, 05:06

Re: Insert text with hotkey combination

#4 Post by ebisu »

scientist wrote:Is there a way to assign a text string to a hot key combination ?
Yes.

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

#5 Post by scientist »

bigpup wrote:Give example of what you want to do and in what program or what?
FF does a poor job of remembering form data.

I would like for example to be able to use a key combination to insert my email address.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

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

Re: re: Insert text with hotkey combination

#6 Post by Bushbuck »

Puppus Dogfellow wrote:

Code: Select all

#!/bin/sh

xdotool type ''
Good one, Puppus.
Just got my first auto-typing command working. :D

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

#7 Post by scientist »

xdotool is not in PPM.

My experience in installing other distro versions has rarely been successful.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

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

#8 Post by scientist »

I found xdotool.

It has no file extension and does nothing when run ?
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

Re: re: Insert text with hotkey combination

#9 Post by Puppus Dogfellow »

Bushbuck wrote:
Puppus Dogfellow wrote:

Code: Select all

#!/bin/sh

xdotool type ''
Good one, Puppus.
Just got my first auto-typing command working. :D
cool. glad to be of help.

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

#10 Post by Bushbuck »

scientist wrote:I found xdotool.

It has no file extension and does nothing when run ?
On mine, it prints out the same blurb as --help when you run it with no parameters. It's version 3.20140217.1 if that helps, but I'm in Tahr Puppy 6.02.

PS, It doesn't need a file extension.

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

get 11 blank autotext scripts, open them for editing.

#11 Post by Puppus Dogfellow »

requires xdotool. use a launcher like pexec or gexec and/or assign a shortcut key.

Code: Select all

echo $'#!/bin/sh
xdotool type \'\'
#Place desired text output between the single quotes above.
#at -- autotext---place in /nwp or a bin. make a series...' > /root/my-applications/bin/at
cd /root/my-applications/bin; for f in at{1..10} ; do cp at $f ; done
chmod 755 /root/my-applications/bin/at1 /root/my-applications/bin/at2 /root/my-applications/bin/at3 /root/my-applications/bin/at4 /root/my-applications/bin/at5 /root/my-applications/bin/at6 /root/my-applications/bin/at7 /root/my-applications/bin/at8 /root/my-applications/bin/at9 /root/my-applications/bin/at10  /root/my-applications/bin/at

you can assign the scripts to keys, but if you think you will have many, it may be better to use a launcher. sample use:

Code: Select all

xdotool type ''
does nothing.

Code: Select all

xdotool type 'phick zit'
types out:

phick zit

Code: Select all

xdotool type 'phi
x z
i
t
'
types out:

phi
x z
i
t


---

script is making a template, then making ten copies of it, then setting the perimissions, then opening the blanks. you could also put it directly into jwm,

Code: Select all

<Key mask="SAC" key="S">exec:at1</Key>

Code: Select all

<Key mask="SC" key="S">exec:xdotool type 'long, forgettable thing or string'</Key>

hth

(tested in a precise derivative.)


----

edit: this one will make an xdotool autotype script:

Code: Select all

#!/bin/sh
xdotool type "
#!/bin/sh
xdotool type ''
"

#you need the double quotation marks to have the singles from the code show (same thing the $ \  \ in the first script in the post does).

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

#12 Post by scientist »

Since xdotool does not work on my system, I found this.

But Ctrl-v does not show the character sequence, it pops up the menu.

How can I see the character sequences?

Code: Select all

You can determine the character sequence emitted by a key by pressing Ctrl-v at the command line, then pressing the key you're interested in. On my system for F12, I get ^[[24~. The ^[ represents Esc. Different types of terminals or terminal emulators can emit different codes for the same key.

At a Bash prompt you can enter a command like this to enable the key macro so you can try it out.

bind '"\e[24~":"foobar"'

Now, when you press F12, you'll get "foobar" on the command line ready for further editing. If you wanted a keystroke to enter a command immediately, you can add a newline:

bind '"\e[24~":"pwd\n"'
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

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

#13 Post by scientist »

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
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

#14 Post by Semme »

You can run, but you can't hide. :wink: I understand why JM.. B----- Y--- A--!

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

#15 Post by scientist »

Letting anger control you ?

[/img]
Attachments
e6StX8.jpg
(25.52 KiB) Downloaded 277 times
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

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

#16 Post by Bushbuck »

scientist wrote:I have got xdotool to run.

How would I assign 'test' to Shift F11 ?
You'd need to edit jwmrc.personal. jwmrc might appear to work, but changes will get wiped when you do anything that rebuilds the menu.

If you run xev in a terminal, you can find out what keycodes the keys generate.

It's a good idea to back the file up first, as it's possible to lose the menu if you get the XML wrong.
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.

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

#17 Post by scientist »

I do not have a jwmrc.personal.
Thanks,
Andy


Slacko 6.3.0 FULL INSTALL
JWM
File Manager - Thunar

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

#18 Post by scientist »

I found it.

It is jwmrc-personal.
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

#19 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

Code: Select all

<Key mask="S" key="F11">exec:at1</Key> 
if at1 is in the PATH,

Code: Select all

<Key mask="S" key="F11">exec:/path/to/at1</Key>
if it's not.

jwm -restart.

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

#20 Post by MochiMoppel »

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.
Attachments
xdotool.png
(43.34 KiB) Downloaded 269 times

Post Reply