Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- /**
- * Click through gurlz and talk to them every 10 seconds,
- * then keep clicking the prioritized gurl for hearts.
- * Rinse and repeat.
- *
- * required:
- * + PHP7 (because of direct array access)
- * + xdotool
- *
- * 1. Save this as e.g. "clicker.sh"
- * 2. chmod +x clicker.sh
- * 3. run
- *
- * Toggle on/off with Capslock
- */
- $CLICK_POSITIONS = array();
- $CLICK_POSITION_BUTTON = array();
- $DELAY = 10;
- $TIME_LAST = 0;
- $TIMER = 0;
- $OLD_TOGGLE = -1;
- $PRIO=0;
- do {
- $NUM_GURLZ = readline("How many gurlz: ");
- } while(!is_numeric($NUM_GURLZ));
- for ($i=0; $i<$NUM_GURLZ; $i++) {
- do {
- $INPUT=readline("Please move mouse over gurl ".($i+1)." and press enter\n");
- } while ($INPUT != '');
- $shell = exec('xdotool getmouselocation');
- $x = explode(':', explode(' ', $shell)[0])[1];
- $y = explode(':', explode(' ', $shell)[1])[1];
- $CLICK_POSITIONS[] = [$x, $y];
- echo "position of cursor: ".$x ." / " . $y . "\n";
- }
- do {
- $INPUT=readline("Please move mouse over liek button ".($i+1)." and press enter\n");
- } while ($INPUT != '');
- $shell = exec('xdotool getmouselocation');
- $x = explode(':', explode(' ', $shell)[0])[1];
- $y = explode(':', explode(' ', $shell)[1])[1];
- $CLICK_POSITION_BUTTON[0] = [$x, $y];
- echo "position of cursor: ".$x ." / " . $y . "\n";
- do {
- $PRIO = readline("Which to prioritize: ");
- } while(!is_numeric($PRIO));
- echo "Now click once to focus window\n";
- while(true) {
- // check if window is the correct one
- $shell = exec("xdotool getwindowfocus getwindowname");
- // check if toggle is on
- # sleep 1s
- $CURRENT_WINDOW_NAME = $shell;
- $CURRENT_TOGGLE = exec('xset -q | grep "Caps Lock: on" | wc -m');
- if ( $CURRENT_TOGGLE != $OLD_TOGGLE ) {
- if ( $CURRENT_TOGGLE > 0 ) {
- echo "Toggle Capslock (on)\n";
- $TIME_LAST = time();
- exec("xdotool mousemove ".$CLICK_POSITIONS[$PRIO-1][0]." ".$CLICK_POSITIONS[$PRIO-1][1]);
- } else {
- echo "Toggle Capslock (off)\n";
- }
- }
- $OLD_TOGGLE = $CURRENT_TOGGLE;
- if (time() - $TIME_LAST > $DELAY) {
- $TIME_LAST = time();
- if ( "$CURRENT_WINDOW_NAME" == "Crush Crush" && $CURRENT_TOGGLE > 0) {
- for ($i=0; $i<$NUM_GURLZ; $i++) {
- exec("xdotool mousemove ".$CLICK_POSITIONS[$i][0]." ".$CLICK_POSITIONS[$i][1]);
- usleep(1000);
- exec ("xdotool click 1");
- usleep(1000);
- exec("xdotool mousemove ".$CLICK_POSITION_BUTTON[0][0]." ".$CLICK_POSITION_BUTTON[0][1]);
- usleep(1000);
- exec ("xdotool click 1");
- usleep(1000);
- }
- exec("xdotool mousemove ".$CLICK_POSITIONS[$PRIO-1][0]." ".$CLICK_POSITIONS[$PRIO-1][1]);
- usleep(1000);
- exec ("xdotool click 1");
- }
- } else {
- if ( "$CURRENT_WINDOW_NAME" == "Crush Crush" && $CURRENT_TOGGLE > 0) {
- exec("xdotool mousemove ".($CLICK_POSITION_BUTTON[0][0] + 200)." ".$CLICK_POSITION_BUTTON[0][1]);
- usleep(1000);
- exec ("xdotool click 1");
- usleep(1000);
- }
- }
- usleep(5000);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment