xdotool my commands dont wanna work really. whats wrong here? :)

Deeds2

New Member
Credits
90
hay guys, im new here. and im a beginenr in linux. and i hope you understand me with my funny-english :)

okay lets go. whats my problem? i wanna try to use xdotool. my script is there.. but its not work.. i dont find anywhere help more.. so i try it here :)

dont see the spoiler-botten sorry for the long message now

here my complett script.:








#!/bin/bash
while [ 1 ]; do
xdotool mousemove 1915 260 click 1

xdotool mousemove 357 474 click 1

xdotool mousemove 355 590 click 1 (zustand sehr gut)

xdotool mousemove 814 557 click 1 standard bild löschen

xdotool mousemove 757 598 click 1

xdotool mousemove 873 180 click 1 bild 1? hier ist vielleicht ein fehler

xdotool mousemove 1546 1014 click 1 &
sleep 5

xdotool mousemove 872 608 click 1

xdotool mousemove 555 136 click 1 bild3

xdotool mousemove 1546 1014 click 1 &
sleep 5
xdotool mousemove 984 585 click 1

xdotool mousemove 583 158 click 1 bild2

xdotool mousemove 1546 1014 click 1 &
sleep 5


xdotool mousemove 1912 615 click 1 leiste zum text

xdotool mousemove 701 609 click 1 &
sleep 2
clear mode


--clearmodifiers

$ xdotool type --delay [500] "Hayho Leude,

extrem loooong text :D "

xdotool mousemove 388 914 click 1

xdotool mousemove 349 974 click 1 festpreis auswählen

xdotool mousemove 1914 721 click 1


xdotool mousemove 384 390 click 1


clear mode


--clearmodifiers
sleep 2
xdotool mousemove 384 390 click 1

xdotool key "1,1" &
sleep 5
xdotool mousemove 1919 1015 click 1
done



this are commands to safe for me.. when copy past dont work.. i can change it with this commands :)
xdotool key "ctrl+a"
xdotool key "ctrl+v"


okay.. where are the fail here? your fails :) ?


other guys offer me to make a script for me.. but i need more as 20 of them.. and so i wanna udnerstand it how i do it self.. and i can understand many of this commands. so its be nice, when we can use this next. :)

maybe you need this infomation:
i use linux mint 20.1 cinnomon
i think i must make this script to a -sh data. to work then. i want it as script, not in terminal.
you need more infos? tell it me :)
 


wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
13,708
G'day @Deeds2 and welcome to linux.org :):)

Don't bump, we consider it rude.

See my cursor below for Spoiler button location.



I am moving this Thread to Command Line, where scripting enquiries are also handled.

Good luck

Chris Turner
wizardfromoz
 

JasKinasis

Well-Known Member
Credits
5,990
I don't use xdotool, so it's hard to see where the problems are.
From a quick look, the syntax of the commands looks OK.
What errors are you getting when you run your script?
If you could copy/paste the output of the script - including any error messages, it would help us to diagnose your problem.

Also, have you tried running your script in bash in debug mode?
If not try:
Bash:
bash -x /path/to/yourscript
Where /path/to/yourscript is the path/filename of your script.
That will run your script and list each line that gets ran and will also tell us the first point of failure in your script.
Copy/paste the output from that and we might have some idea what's going on.
 

Deeds2

New Member
Credits
90
hayho,
hmm, its happent nothing. my mouse dont move, my keyboard make nothing. no errors nothing what i see :/ give it any settings to become a error message?

commands are copy past of some foren about xdotool.
my problem is more.. how to build a script with many commands. is my start right? its okay, when overall is a return? is my text to long? must i writhing overall "done" after the command ?

im a beginner and this is my secound script. the other script was making with a friend.. he help me a lot to join the linux world :) its was a easy -sh script about shut down command for the pc. like click on script - pc shut down. more not :)


okay now i test your command:
[email protected]:~$ bash -x '/home/deeds/Bilder/dvd sehr gut 1 euro sofortkauf 3 bilder.sh'
/home/deeds/Bilder/dvd sehr gut 1 euro sofortkauf 3 bilder.sh: Zeile 14: Syntaxfehler beim unerwarteten Wort »(«
/home/deeds/Bilder/dvd sehr gut 1 euro sofortkauf 3 bilder.sh: Zeile 14: `xdotool mousemove 355 590 click 1 (zustand sehr gut)'
[email protected]:~$

okay now i delate all my notiz/infos in this script. okay

now i become that:

[email protected]:~$ bash -x ''/home/deeds/Musik/dvd sehr gut 1 euro sofortkauf 3 bilder.sh'
>
>
>
>

need i a new command after the first command to let it run?

next question.. i try to run it now.. so i click the -sh data. then its open a windows with 4 settings. like run it, open it, exit ..
but now its dont come. i seach to open it with.. and then terminal. but now i dont find terminal more.. or need i a other tool/programm to elt it run?
in videos everybody use terminal. dunno why..
how i let run it in terminal? when i copy the command line.. nothing happents.. and when i click the data and "send" it to terminal.. become i that:

[email protected]:~$ '/home/deeds/Musik/dvd sehr gut 1 euro sofortkauf 3 bilder.sh'
bash: /home/deeds/Musik/dvd sehr gut 1 euro sofortkauf 3 bilder.sh: Keine Berechtigung


okay, we get a step next :)
 

JasKinasis

Well-Known Member
Credits
5,990
OK. My German is a little rusty, so I had to translate the error messages.
I've installed xdotool on my laptop last night and had a play with it and had a quick look at the syntax for it.
And looking again at the code in your original post - I can see some problems.

1.) Your infinite while loop is absolutely fine. It will work. But personally - rather than using while [1]; do I find it's quicker and cleaner to use while :; do instead.

: is a bash builtin that always returns 0. So using while :; do is effectively the same as using while true; do
Like I said - not a problem, just a personal style choice. I'm really lazy, if I can do something by typing a few less characters - I'll do it! Ha ha!

2.) All of the lines like this are OK:
Bash:
xdotool mousemove 1915 260 click 1
3.) The lines like this are wrong:
Bash:
xdotool mousemove 355 590 click 1 (zustand sehr gut)
In the above, it looks like you've attempted to add some comments at the end of the line, but you haven't used a # to indicate to the interpreter/shell that what follows is a comment.
In bash, comments start with a #.

You can fix the problem with the line in the code-block above AND keep your comments by adding a # at the start of the comment like this:
Bash:
xdotool mousemove 355 590 click 1 #(zustand sehr gut)
Do the same for all of the other lines where you have added text/comments. You should insert a # where each comment begins.

4.) I don't know what this is supposed to be:
Bash:
clear mode
I'm assuming this is another comment?
If so - start the line with a # to indicate to the shell that it is a comment.
Otherwise the clear command can take parameters, but mode is definitely not one of them!
So you'll need to explain what that's supposed to be if it is not a comment.

5.) The lines where you have used --clearmodifiers on its own are incorrect and will throw up some errors.
--clearmodifiers cannot be used on it's own. It's not a standalone command, or a bash-builtin. It is an option for certain xdotool commands/actions which can be used to clear any active input modifiers that have been set. But it MUST be used with a valid xdotool command/action - e.g. type, or key etc etc.

I'll explain what the --clearmodifiers option does with a simple, practical example:
Open a terminal and type the following command - BUT DON'T press enter yet:
Bash:
xdotool key a
Now hold the shift key down and then press and release enter (with the shift key still down) to run the command - after pressing enter you will see an uppercase A appear. NOT the lowercase a you expected.
This is because you had the shift key held down when xdotool was ran.

So if you strictly wanted a lowercase a key-hit to be generated and not an uppercase A, then you would need to use the --clearmodifiers option to make xdotool ignore that the shift key is pressed.
e.g.
Try typing this command (without entering it yet!):
Bash:
xdotool key --clearmodifiers a
Now hold down the shift key and press enter to run the command (keeping the shift key held down).
Now, because we've used the --clearmodifiers option, xdotool will ignore the fact that the shift key is pressed and will display a lowercase a, exactly as we wanted.

So that's a practical usage of the --clearmodifiers option. It can be used with several other xdotool commands.
I'd recommend taking a look at the man page for xdotool.
Bash:
man xdotool
So with my recommended edits, your script would look something like this:
Bash:
#!/bin/bash
while :; do
  xdotool mousemove 1915 260 click 1
  xdotool mousemove 357 474 click 1
  xdotool mousemove 355 590 click 1 #(zustand sehr gut)
  xdotool mousemove 814 557 click 1 #standard bild löschen
  xdotool mousemove 757 598 click 1
  xdotool mousemove 873 180 click 1 #bild 1? hier ist vielleicht ein fehler
  xdotool mousemove 1546 1014 click 1 &
  sleep 5
  xdotool mousemove 872 608 click 1
  xdotool mousemove 555 136 click 1 #bild3
  xdotool mousemove 1546 1014 click 1 &
  sleep 5
  xdotool mousemove 984 585 click 1
  xdotool mousemove 583 158 click 1 #bild2
  xdotool mousemove 1546 1014 click 1 &
  sleep 5
  xdotool mousemove 1912 615 click 1 #leiste zum text
  xdotool mousemove 701 609 click 1 &
  sleep 2
  #clear mode
  #--clearmodifiers
  xdotool type --delay [500] "Hayho Leude,
  extrem loooong text :D "
  xdotool mousemove 388 914 click 1
  xdotool mousemove 349 974 click 1 #festpreis auswählen
  xdotool mousemove 1914 721 click 1
  xdotool mousemove 384 390 click 1
  #clear mode
  #--clearmodifiers
  sleep 2
  xdotool mousemove 384 390 click 1
  xdotool key "1,1" &
  sleep 5
  xdotool mousemove 1919 1015 click 1
done
I've left the clear mode and --clearmodifiers lines commented out too because I don't know your intentions with those lines.

I hope this helps!

EDIT:
I haven't actually tested the edited script on my laptop yet. I'll try it this evening after I've finished work. But I'm fairly confident that what is there will move the mouse, click and press keys/type text.
 
Last edited:

Deeds2

New Member
Credits
90
wow THANKS :D

ya in the linux groups help somebody everytime. i like that much :D

first: i did only 1.2.3. and 4. nr. 5 i dont did cause i have to less time now. i try to make it later.

but to nr 5
clear mode was my command.
its should work for this tool, cause i have this command from a guild site.

the job is simple: with my command you click then in a field. in this field is sometime a text, sometime nothing. i dont need the "old text" in this field. so i clean it. delate it. thats too why i safe the command line for csrg c and v.. so i can use this command, what work better. :) its nevermind for me how i delate this old text.. mouse - right click - delate, xsrg c v .. or delate task .. how ever.. only the goal is important :)

i understand this command clear mode that he delate all, what he can pick then.. in my explain he delate the full text in this field.

okay, he isnt a solo command, okay dont know it.
so maybe its easier when we use only:

xdotool key "ctrl+a"
sleep 1
xdotool key "ctrl+v"

or what do you think?

okay must work next. cu later :D and thanks for supporting :D
 

Deeds2

New Member
Credits
90
okay i have this now:

#!/bin/bash
while 1; do
xdotool mousemove 1915 260 click 1

xdotool mousemove 357 474 click 1

xdotool mousemove 355 590 click 1 #zustand sehr gut

xdotool mousemove 814 557 click 1 #standard bild löschen

xdotool mousemove 757 598 click 1

xdotool mousemove 873 180 click 1 #bild 1? hier ist vielleicht ein fehler

xdotool mousemove 1546 1014 click 1 &
sleep 5

xdotool mousemove 872 608 click 1

xdotool mousemove 555 136 click 1 #bild3

xdotool mousemove 1546 1014 click 1 &
sleep 5
xdotool mousemove 984 585 click 1

xdotool mousemove 583 158 click 1 #bild2

xdotool mousemove 1546 1014 click 1 &
sleep 5









xdotool mousemove 1912 615 click 1 #leiste zum text

xdotool mousemove 701 609 click 1 &
sleep 2
clear mode


xdotool key "ctrl+a"
xdotool key "ctrl+v"

xdotool type --delay [500] "Hayho Leude,
looong text "

xdotool mousemove 388 914 click 1

xdotool mousemove 349 974 click 1 #festpreis auswählen

xdotool mousemove 1914 721 click 1


xdotool mousemove 384 390 click 1

#eventuell löschen
sleep 2
xdotool mousemove 384 390 click 1

xdotool key "1,1" &
sleep 5
xdotool mousemove 1919 1015 click 1
done

okay some guys told me i should use it first in terminal, befor i made a -sh data. they mean its smarter cause we can see then any errors, when somethink dont work.

how my problem is.. how make i that?
he told me that:
also make the file executable (chmod +x script-name), I also don't know how you're trying to run it but please use ./script-name from a terminal in the folder where it exists in

i need it more simpler, sorry beginenr :)
my sh data becam a new name. its test2 now. td shurt, and sure better to make less errors :)
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top