Automatic Click Program

Forum Forums New users New Users and General Questions Automatic Click Program

  • This topic has 13 replies, 6 voices, and was last updated Apr 7-8:15 pm by felipecardope.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #56993
    Member
    felipecardopefelipecardope

    Hello everybody.
    I’m searching here on the forum for information about an automatic click program for antiX.
    I searched the internet and found programs for Ubuntu, but I don’t know if they will work on antiX.
    If anyone can help me, I appreciate it.

    Olá a todos.
    Eu estou pesquisando aqui no forum informações sobre um programa de cliques automáticos para o antiX.
    Pesquisei na internet e encontrei programas para Ubuntu, mas eu não sei se vão funcionar no antiX.
    Se alguêm puder me ajudar, eu agradeço.

    #56994
    Moderator
    Brian MasinickBrian Masinick

    Tell us what you want to do with the automatic click programs?

    What applications and functionality will they assume instead of the apps that antiX offers now?

    Brian Masinick

    #56996
    Moderator
    Brian MasinickBrian Masinick

    https://sourceforge.net/projects/orphamielautoclicker/

    Does this help?

    • This reply was modified 1 week, 4 days ago by Brian Masinick.

    Brian Masinick

    #56999
    Member
    Avatarseaken64

    What were the names of the programs you found for Ubuntu? Might help if we knew what to compare to.

    seaken64

    #57008
    Member
    XecureXecure

    xdotool, already installed in antiX.

    If you are talking about task automation tools, check alternativeto.net
    https://alternativeto.net/software/autohotkey/?platform=linux

    #57010
    Member
    felipecardopefelipecardope

    I intend to use it to play internet games that use the mouse and several clicks. The autoclicker worked with wine.

    The programs I found for Ubuntu were Auto Mouse Click from MurGuu.com and auto-click.sh from https://brunoantuness.wordpress.com/2017/05/29/auto-click-no-linux/

    And at https://qastack.com.br/ubuntu/523251/run-a-program-x-times run_xdotool.sh:

    #! / bin / bash

    x = 1
    while [$ x -le 10]
    of
    xdotool click –delay 1000 –repeat 10 1
    sleep 1
    x = $ (($ x + 1))
    done

    I don’t understand this and I don’t know how to stop.

    I thank you for the answers.

    Eu pretendo usar para jogar jogos da internet que utilizam o mouse e vários cliques. O autoclicker funcionou com o wine.

    Os programas que eu encontrei para o Ubuntu foram o Auto Mouse Click do MurGuu.com e auto-click.sh do https://brunoantuness.wordpress.com/2017/05/29/auto-click-no-linux/

    E no https://qastack.com.br/ubuntu/523251/run-a-program-x-times o run_xdotool.sh:

    #!/bin/bash

    x=1
    while [ $x -le 10 ]
    do
    xdotool click –delay 1000 –repeat 10 1
    sleep 1
    x=$(( $x + 1 ))
    done

    Eu não entendo isso e não sei como parar.

    Eu agradeço pelas repostas.

    #57012
    Moderator
    Brian MasinickBrian Masinick

    Read the xdoltool man page; here is a short abstract:

    DOTOOL(1) XDOTOOL(1)

    NAME
    xdotool – command-line X11 automation tool

    SYNOPSIS
    xdotool cmd args…

    Notation: Some documentation uses [window] to denote an optional window
    argument. This case means that the argument, if not present, will
    default to “%1”. See “WINDOW STACK” for what “%1” means.

    DESCRIPTION
    xdotool lets you programmatically (or manually) simulate keyboard input
    and mouse activity, move and resize windows, etc. It does this using
    X11’s XTEST extension and other Xlib functions.

    There is some support for Extended Window Manager Hints (aka EWMH or
    NetWM). See the “EXTENDED WINDOW MANAGER HINTS” section for more
    information.

    Comments: In essence this tool allows you to perform keyboard and mouse activities through the program. In your script, you are looping up to ten times, and you are repeating what appears to be ten mouse clicks each second, waiting a second, and repeating ten mouse clicks. I’m not an expert with this tool, having never used it, so I am not 100% positive that is the actual behavior, but that is what appears to be the intent, or something similar. By altering the parameters and numbers used in the script, you can alter the manner in which you use the tool.

    Others who are more certain of the actual behavior may provide better, more precise and accurate explanations, but this is my “best guess” at what is taking place.
    As far as xdotool, this IS a tool that could easily be installed (if not installed for some reason; Xecure states it IS installed by default). Run the command sudo apt-get update; sudo apt-get install xdotool and it should be possible to install it.

    • This reply was modified 1 week, 3 days ago by Brian Masinick.

    Brian Masinick

    #57016
    Forum Admin
    DaveDave

    First get the window ID by running
    xdotool selectWindow
    The I use a script like this for when a window does not loose focus.

    #!/bin/bash
    while : ; 
    do
    	xdotool click --window $1 1
            sleep 10
    done
    

    and run it like
    ./clicker1.sh 100663303

    If it is a window that looses focus and I need to work on something else I use a script like

    #!/bin/bash
    while : ; 
    do
    	current_window=<code>xdotool getactivewindow</code>
            current_mouse_location=<code>xdotool getmouselocation</code>
            current_mouse_location_x=<code>echo &quot;$current_mouse_location&quot; |cut -d &quot; &quot; -f1 |cut -d &quot;:&quot; -f2</code>
            current_mouse_location_y=<code>echo &quot;$current_mouse_location&quot; |cut -d &quot; &quot; -f2 |cut -d &quot;:&quot; -f2</code>
            xdotool windowactivate $1
    	xdotool mousemove --window $1 940 525
    	xdotool key --window $1 Escape &&
    	sleep 0.1
     	xdotool click --window $1 1
    	xdotool type --window $1 c
    	xdotool windowactivate $current_window
    	xdotool mousemove --window $current_window $((current_mouse_location_x-36)) $((current_mouse_location_y-28))
            sleep 10
    done
    

    Which is not the most elegant way to do things… and I rarely use.
    It grabs the id of the window I am currently looking at.
    Gets my current mouse position
    Activates the window that uses the autoclicker
    Moves the mouse to the correct position for the autoclicker.
    Presses escape to get out of the pause menu /chat (the game automatically pauses when the window looses focus, opening chat allows it to run without focus)
    Does a left click
    Opens chat dialog
    Switches back to the window I was working in
    Moves my mouse back to where it was.

    I try not to use this one but instead disable the auto pause on focus lost when possible because this causes the screen to flash between windows which gets annoying (especially when you are using the mouse extensively; Ex: gimp)

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #57056
    Member
    felipecardopefelipecardope

    Dave, I found a code similar to this one and I didn’t like it because I need to inform the position of the mouse.
    I liked the idea of the second but when I ran the script this text appeared below

    felipe @ antix1: ~ / Downloads
    $ ./clicker.sh
    ./clicker.sh: line 9: syntax error next to unexpected `newline ‘token
    ./clicker.sh: line 9: `current_window = xdotool getactivewindow

    Dave, eu encontrei um código parecido com esse e eu não gostei porque eu preciso informar a posição do mouse.
    Eu gostei da ideia do segundo mas quando eu executei o script apareceu esse texto abaixo

    felipe@antix1:~/Downloads
    $ ./clicker.sh
    ./clicker.sh: linha 9: erro de sintaxe próximo ao token inesperado `newline’
    ./clicker.sh: linha 9: `current_window=xdotool getactivewindow

    #57075
    Forum Admin
    DaveDave

    Ah the forum software decided to “correct” the formatting.
    Lets try again
    Also added inline comments and a text attachment.

    #!/bin/bash
    while : ; 
    do
    	current_window=$(xdotool getactivewindow) #Gets id of current window with focus
            current_mouse_location=$(xdotool getmouselocation) #Gets the cursor location 'X x Y'
            current_mouse_location_x=$(echo "$current_mouse_location" |cut -d " " -f1 |cut -d ":" -f2) #Gets the 'x' location for the cursor
            current_mouse_location_y=$(echo "$current_mouse_location" |cut -d " " -f2 |cut -d ":" -f2) #Gets the 'y' location for the cursor
            xdotool windowactivate $1 #Changes focus to the desired window
    	xdotool mousemove --window $1 940 525 #Moves the cursor in to the specified coordinates (940 x 525) in the specified window
    	xdotool key --window $1 Escape && #Presses the escape key in the specified window
    	sleep 0.1 #Slows the key press events so the game does not kick the player 
    	xdotool click --window $1 1 #Does a left click of the mouse in the specified window
    	xdotool type --window $1 c #Presses the 'c' key to open chat
    	xdotool windowactivate $current_window #Changes focus to the window the window recorded at the beginning of the script
    	xdotool mousemove --window $current_window $((current_mouse_location_x-36)) $((current_mouse_location_y-28)) # Moves the cursor back to where it was at the beginning of the script
            sleep 10 #Delay time till next click event
    done
    

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #57117
    Member
    felipecardopefelipecardope

    Dave, I copied the code to the leafpad again and this text appeared below

    Dave, copiei novamente o código para o leafpad e apareceu esse texto abaixo

    felipe@antix1:~/Downloads
    $ ./clicker.sh
    There are no windows in the stack
    Invalid window ‘%1’
    Usage: windowactivate [options] [window=%1]
    –sync – only exit once the window is active (is visible + active)
    If no window is given, %1 is used. See WINDOW STACK in xdotool(1)
    Usage: mousemove [options] <x> <y>
    -c, –clearmodifiers – reset active modifiers (alt, etc) while typing
    –screen SCREEN – which screen to move on, default is current screen
    –sync – only exit once the mouse has moved
    -w, –window <windowid> – specify a window to move relative to.
    You specified the wrong number of args (expected 2 coordinates or ‘restore’).
    You specified the wrong number of args.
    Usage: key [options] <keysequence> [keysequence …]
    –clearmodifiers – clear active keyboard modifiers during keystrokes
    –delay DELAY – Use DELAY milliseconds between keystrokes
    –repeat TIMES – How many times to repeat the key sequence
    –repeat-delay DELAY – DELAY milliseconds between repetitions
    –window WINDOW – send keystrokes to a specific window
    Each keysequence can be any number of modifiers and keys, separated by plus (+)
    For example: alt+r

    Any letter or key symbol such as Shift_L, Return, Dollar, a, space are valid,
    including those not currently available on your keyboard.

    If no window is given, and there are windows in the stack, %1 is used. Otherwise
    the currently-focused window is used
    This command consumes all arguments after it, so you cannot chain
    additional commands after it.
    Usage: click [options] <button>
    –clearmodifiers – reset active modifiers (alt, etc) while typing
    –window WINDOW – specify a window to send click to
    –repeat REPEATS – number of times to click. Default is 1
    –delay MILLISECONDS – delay in milliseconds between clicks.
    This has no effect if you do not use –repeat.
    Default is 100ms

    Button is a button number. Generally, left = 1, middle = 2,
    right = 3, wheel up = 4, wheel down = 5
    You specified the wrong number of args.
    You specified the wrong number of args.
    Usage: type [–window windowid] [–delay milliseconds] <things to type>
    –window <windowid> – specify a window to send keys to
    –delay <milliseconds> – delay between keystrokes
    –clearmodifiers – reset active modifiers (alt, etc) while typing
    –args N – how many arguments to expect in the exec command. This is
    useful for ending an exec and continuing with more xdotool
    commands
    –terminator TERM – similar to –args, specifies a terminator that
    marks the end of ‘exec’ arguments. This is useful
    for continuing with more xdotool commands.
    –file <filepath> – specify a file, the contents of which will be
    be typed as if passed as an argument. The filepath
    may also be ‘-‘ to read from stdin.
    -h, –help – show this help output

    #57121
    Forum Admin
    DaveDave

    Well I generally frown upon straight copy and pasting commands without knowing what they do… but thanks you for saying I am quite trustworthy :D.
    Likely all that is missing is you are not supplying a window id when you run the script.

    I do suggest you read it through and run/investigate each line to see what they do. You are quite likely going to need to modify the script to work for your purpose.

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #57195
    Member
    marcelocripemarcelocripe

    Hello Felipe,

    I couldn’t understand how to use Dave’s code because it is so complex, I also copied and pasted the code (laughs). Xecure indicated several solutions and also xdotool. Mr. Brian indicated a solution that worked with Wine and also brought more information about xdotool. I really like the idea of ​​being able to use the programs that antiX has to its fullest, before having to install other programs, antiX is very rich in solutions that consume little processing and little RAM and this is perfect.

    Searching on the site that you informed, I was able to use only the line “xdotool click –delay 300 –repeat 100 1” in a script with a shortcut icon, when I clicked on the icon it started 100 clicks and at the end it stopped, when I clicked again on the shortcut icon, another 100 clicks started and then stopped. Be careful when using the program so as not to click where you don’t want to when you use it to play internet games. If you want to test, I recommend you use the “IceWM Toolbar Icon Manager” to add the icon to the bar, so it is easier to click on the icon and position the cursor in the desired location. Read the text of the help button of the program “Icon Manager on the IceWM Toolbar”, in adapting the translation to pt-BR I tried to explain in many details, it will be good if you analyze the text and if you can, send me suggestions for improvement.

    #Translated model:
    #xdotool click –delay <delay between clicks> –repeat <amount of repeat clicks> <button>
    # (delay in milliseconds between clicks)

    #xdotool click –delay 1000 –repeat 10 1

    I used this in the test:
    xdotool click –delay 300 –repeat 100 1

    But you can use:
    xdotool click –delay 3000 –repeat 100 1

    To download the script, shortcut icon and explanatory text file on how to use them, download at https://archive.org/details/cliques-automaticos-para-o-antix.

    I hope that you will be able to find the best solution to use in your goal.

    marcelocripe
    (Original text in Brazilian Portuguese)

    ———-

    Olá Felipe,

    Eu não consegui entender como usar o código do Dave por ser muito complexo, eu também copiei e colei o código (risos). O Xecure indicou várias soluções e ainda xdotool. O sr. Brian indicou uma solução que funcionou com o Wine e ainda trouxe mais informações sobre o xdotool. Eu gosto muito da ideia de poder usar os programas que o antiX possui ao máximo, antes de ter que instalar outros programas, o antiX é muito rico em soluções que consomem pouco processamento e pouca memória RAM e isso é perfeito.

    Pesquisando no sítio que você informou, eu consegui usar apenas a linha “xdotool click –delay 300 –repeat 100 1” em um script com um ícone de atalho, quando cliquei no ícone começaram 100 cliques e ao final parou, quando cliquei novamente no ícone de atalho, outros 100 clique começaram e depois parou. Tome cuidado quando for utilizar o programa para não clicar onde não queira quando for usar para jogar jogos da internet. Se você quiser testar, eu recomendo você utilizar o “Gerenciador de Ícones da Barra de Ferramentas do IceWM” para adicionar o ícone na barra, assim fica mais fácil de clicar no ícone e posicionar o cursor no local desejado. Leia o texto do botão de ajuda do programa “Gerenciador de Ícones da Barra de Ferramentas do IceWM”, na adaptação da tradução para pt-BR eu procurei explicar com muitos detalhes, será bom se você analisar o texto e se puder, me enviar sugestões para melhoria.

    #Modelo traduzido:
    #xdotool click –delay <atraso entre os cliques> –repeat <quantidade de repetição dos cliques> <button>
    #(atraso em milissegundos entre os cliques)

    #xdotool click –delay 1000 –repeat 10 1

    Eu usei este no teste:
    xdotool click –delay 300 –repeat 100 1

    Mas você pode usar:
    xdotool click –delay 3000 –repeat 100 1

    Para baixar o script, ícone de atalho e o arquivo de texto explicativo de como utilizá-los, baixe em https://archive.org/details/cliques-automaticos-para-o-antix.

    Eu espero que você consiga encontrar a melhor solução para utilizar no seu objetivo.

    marcelocripe
    (Texto original em idioma Português do Brasil)

    #57226
    Member
    felipecardopefelipecardope

    Thank you all for your help.

    marcelocripe, I managed to use the shortcut icon on the toolbar and managed to adjust this code to give 100 clicks.

    Obrigado a todos pela ajuda.

    marcelocripe, eu consegui usar o ícone de atalho na barra de ferramentas e consegui ajustar esse código para dar 100 cliques.

    xdotool click –delay 200 –repeat 100 1

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.