Jump to content

[Version 1] [code][windows] Facebook Status Auto-post


Elementix
 Share

Recommended Posts

Hey guys, here's some code to auto-post a facebook status. Not sure of why you'd want to have the same status posted every time you plug in the teensy, but maybe someone else can build on it. Feel free to contribute to it.

Cheers! :)

// Facebook Status Updater - Teensy
// Based on vulg4h's Facebook script and iann0036's IP to Twitter script - 5/7/2010 - 2:41PM

int ledPin = 11;


void setup() {

pinMode(ledPin, OUTPUT); // put this before other led commands or the LED will be dim

ledstart(); // lights up when connected
delay(3000); // delay for computer
ledstart(); // lights up when payload starts
Keyboard.set_modifier(MODIFIERKEY_GUI);
Keyboard.send_now();
Keyboard.set_key1(KEY_R);
Keyboard.send_now();
Keyboard.set_key2(0);
Keyboard.send_now();
d(); // this is a 100ms delay, see below for commands.
Keyboard.print("http://facebook.com"); // goes to facebook
d();
enter();
delay(6000); // delay for browser to load
Keyboard.set_key2(KEY_TAB);
Keyboard.send_now();
Keyboard.print("FACEBOOK USERNAME");
Keyboard.send_now();
d();
Keyboard.set_key2(KEY_TAB);
Keyboard.send_now();
d();
Keyboard.print("FACEBOOK PASSWORD");
Keyboard.send_now();
enter();
delay(9000); // let browser load
  Keyboard.set_modifier(MODIFIERKEY_CTRL); // set browser to search-page
  Keyboard.set_key1(KEY_F);
  sendClearKeys(); delay(100);
  Keyboard.print("What's on"); // search for "What's on"  
  Keyboard.set_key1(KEY_ESC); // escape search
  sendClearKeys(); delay(100);
  Keyboard.set_key1(KEY_DELETE);
  sendClearKeys(); delay(100);
  Keyboard.set_key1(KEY_DELETE);
  sendClearKeys(); delay(100);
  Keyboard.print("FACEBOOK STATUS TO BE POSTED"); // new status content
  delay(100);
  Keyboard.set_key1(KEY_TAB);
  sendClearKeys();
  enter();
}

void loop() {
  // Maybe a flashing LED?
}

void enter() {
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

void sendClearKeys() {
  Keyboard.send_now();
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.send_now();
}

// LED command for end of script.
void ledend(){

Keyboard.set_key1(0);
Keyboard.set_key2(0);
Keyboard.set_modifier(0);
Keyboard.send_now();

digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
}
// LED command for start of script
void ledstart(){

digitalWrite(ledPin, HIGH);
delay (1000);
digitalWrite(ledPin, LOW);
}
// delay 100ms
void d(){
delay(100);
}

Edited by Elementix
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...