Seshan Posted April 27, 2010 Share Posted April 27, 2010 (edited) This should open Spot Light It's uses CMD+Space, but since spot lights command can easily be changed or you can even disable spot light all together it may not work. What it does: Blinks once when starting the code Quits any popup that pops up Opens spot light Searches and opens terminal Pings google (this can be changed to what ever you want it to do CTRL+C to stop anything running Quits terminal Blinks twice when it finishes running. int ledPin = 11; void setup() { pinMode(ledPin, OUTPUT); } void loop() { delay(8000); //LED blinks when code starts digitalWrite(ledPin, HIGH); delay (1000); digitalWrite(ledPin, LOW); // Command key Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); // Command key + Q to quit any pop ups Keyboard.set_key1(KEY_Q); Keyboard.send_now(); // releases Q key Keyboard.set_key1(0); Keyboard.send_now(); // delay delay(500); // open spotlight Keyboard.set_key1(KEY_SPACE); Keyboard.send_now(); // releases keys Keyboard.set_modifier(0); Keyboard.set_key1(0); Keyboard.send_now(); // open terminal Keyboard.print("terminal.app"); // delay delay(50); Keyboard.set_key1(KEY_ENTER); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); // delay for termianl to load delay(4000); // enters someothing in terminal Keyboard.print("ping www.google.ca"); delay(50); Keyboard.set_key1(KEY_ENTER); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); //time for command to run delay(9000); //stops commands Keyboard.set_modifier(MODIFIERKEY_CTRL); Keyboard.send_now(); Keyboard.set_key1(KEY_C); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.set_modifier(0); Keyboard.send_now(); //quits terminal Keyboard.set_modifier(MODIFIERKEY_GUI); Keyboard.send_now(); Keyboard.set_key1(KEY_Q); Keyboard.send_now(); Keyboard.set_key1(0); Keyboard.send_now(); delay(200); //led blinks twice when code ends digitalWrite(ledPin, HIGH); delay (1000); digitalWrite(ledPin, LOW); delay (1000); digitalWrite(ledPin, HIGH); delay (1000); digitalWrite(ledPin, LOW); delay(900000); } Edited April 27, 2010 by Seshan Quote Link to comment Share on other sites More sharing options...
deleted Posted April 27, 2010 Share Posted April 27, 2010 This way does work and will work on a lot of Mac's, but will encounter some issues. Example, I just ran it, and instead of running Terminal it ran a program I have called "Terminal Emulator" which will not run the commands, just something to bare in mind. But cool none the less. Quote Link to comment Share on other sites More sharing options...
Seshan Posted April 27, 2010 Author Share Posted April 27, 2010 Yeah there are to many variables with OS X, when you type just "terminal" into spot light does terminal show up? Quote Link to comment Share on other sites More sharing options...
deleted Posted April 27, 2010 Share Posted April 27, 2010 Yeah there are to many variables with OS X, when you type just "terminal" into spot light does terminal show up? Yes it does show up, its just not the first option, and this assumes that it will be the first option. Quote Link to comment Share on other sites More sharing options...
Seshan Posted April 27, 2010 Author Share Posted April 27, 2010 Damn, to bad there is no keyboard short cut to open the terminal. Maybe if I tell it to type terminal.app? Quote Link to comment Share on other sites More sharing options...
deleted Posted April 27, 2010 Share Posted April 27, 2010 Damn, to bad there is no keyboard short cut to open the terminal. Maybe if I tell it to type terminal.app? Yes, that selects it as the first option. :D Quote Link to comment Share on other sites More sharing options...
Seshan Posted April 27, 2010 Author Share Posted April 27, 2010 Sweet, thanks for the help. :D The code has been changed. :D Quote Link to comment Share on other sites More sharing options...
fondu Posted April 30, 2010 Share Posted April 30, 2010 You could just make it search Terminal.app in spotlight. Quote Link to comment Share on other sites More sharing options...
Seshan Posted April 30, 2010 Author Share Posted April 30, 2010 You could just make it search Terminal.app in spotlight. Thats what it does... Quote Link to comment Share on other sites More sharing options...
Netshroud Posted May 1, 2010 Share Posted May 1, 2010 Suggestion: What you type in Terminal should be "somecommand -with -some args && killall Terminal" to kill the terminal once the payload completes. This won't work for constant payloads such as ping, however most payloads will be quick, not something which stays running forever. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.