Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

testing xdotool command

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
mazda1
Posts: 47
Joined: 2023-04-09 21:29
Has thanked: 5 times

testing xdotool command

#1 Post by mazda1 »

hello ,

this command seems somewhat peculiar to me because each time I test it in a terminal I have to reinitialize the prompt :

Code: Select all

:~$ xdotool type "example" 
example:~$ example^C  ----> [Ctrl + c] to initialize the prompt

:~$ xdotool type "example" ;  xdotool key Return
example
:~$ example
bash: example : command not found
:~$  
adding xdotool key Return almost did the trick , but there must be a cleaner way so that executing this command ends with a normal prompt .

User avatar
manyroads
Posts: 81
Joined: 2021-04-17 14:27
Has thanked: 1 time
Been thanked: 13 times

Re: testing xdotool command

#2 Post by manyroads »

What precisely are you attempting to do with xdotool?
Pax vobiscum,
Mark Rabideau- Prof Genealogist - http://many-roads.com
Linux BLOG https://eirenicon.org
spectrwm,i3wm,hlwm,bspwm,dwm
Linux User #449130

mazda1
Posts: 47
Joined: 2023-04-09 21:29
Has thanked: 5 times

Re: testing xdotool command

#3 Post by mazda1 »

manyroads wrote: 2023-05-23 13:46 What precisely are you attempting to do with xdotool?
nothing special for the time being , I just want to learn how to use it as I did previously with other commands that I thought would eventually be useful . For now I would like to know if it is possible to imitate the printf command which , just adding \n at the right place , gives place to an initialized prompt :

Code: Select all

:~$ printf "hello"
hello:~$ ^C  ---> ctrl + c to initialize the prompt

which can automatically be done :

:~$ printf "hello\n"
hello
:~$ 
Is there anything like \n for xdotool ?

Random_Troll
Posts: 444
Joined: 2023-02-07 13:35
Been thanked: 105 times

Re: testing xdotool command

#4 Post by Random_Troll »

The type option accepts newlines:

Code: Select all

xdotool type "example
"
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.

mazda1
Posts: 47
Joined: 2023-04-09 21:29
Has thanked: 5 times

Re: testing xdotool command

#5 Post by mazda1 »

I thought it was xdotool which was peculiar but it's xdotool + type which has a weird behavior ( for me ) , because if I use another option like get_num_desktops or get_desktop everything is as usual :

Code: Select all

:~$ xdotool get_num_desktops
4
:~$ xdotool get_desktop
1
:~$ 
then my search on the net wil be different as I will concentrate on type rather than xdotool

mazda1
Posts: 47
Joined: 2023-04-09 21:29
Has thanked: 5 times

Re: testing xdotool command

#6 Post by mazda1 »

Random_Troll wrote: 2023-05-23 15:04 The type option accepts newlines:

Code: Select all

xdotool type "example
"
I finally found how to change line so I could write the second " on the line below and the result is a bit surprising :

Code: Select all

:~$ xdotool type "example
"
example
:~$ example
bash: example: command not found
:~$ 
I guess that those two lines
~$ example
bash: example: command not found
are normal even if I have no clue about their utility .

many thanks to those who answered my question

Random_Troll
Posts: 444
Joined: 2023-02-07 13:35
Been thanked: 105 times

Re: testing xdotool command

#7 Post by Random_Troll »

mazda1 wrote: 2023-05-23 17:20I have no clue about their utility
Does this help:

Code: Select all

$ xdotool type "echo hello
> echo another line
> "
echo hello
echo another line
$ echo hello
hello
$ echo another line
another line
$ 
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.

mazda1
Posts: 47
Joined: 2023-04-09 21:29
Has thanked: 5 times

Re: testing xdotool command

#8 Post by mazda1 »

Random_Troll wrote: 2023-05-23 17:29 Does this help:
I am not too sure I understand the meaning of it because the manual about the option type says : type [options] something to type . But what I see is more than typing text , it also is executing twice the echo command . Am I right ? If I am right then this command is more complex than what I thought . If I am right .

OK .. I may have understood what's going on in the "echo hello ..... " case :

1- echo "hello" then echo "another line" are typed as the manual says
2- those two echo are recognized by Bash as commands , then executed .

But in my command with "example" example is not a command still Bash tried to execute it . So no matter what Bash tries to execute what could be a command . Well.... I might be completely wrong .
Last edited by mazda1 on 2023-05-23 19:57, edited 3 times in total.

Random_Troll
Posts: 444
Joined: 2023-02-07 13:35
Been thanked: 105 times

Re: testing xdotool command

#9 Post by Random_Troll »

Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.

User avatar
manyroads
Posts: 81
Joined: 2021-04-17 14:27
Has thanked: 1 time
Been thanked: 13 times

Re: testing xdotool command

#10 Post by manyroads »

Pax vobiscum,
Mark Rabideau- Prof Genealogist - http://many-roads.com
Linux BLOG https://eirenicon.org
spectrwm,i3wm,hlwm,bspwm,dwm
Linux User #449130

Post Reply