Send onetime Text to Computer

Hi,
I have Digispark Attiny85 USB,
I need to unlock my computer by connecting the Digispark with my own password.
I wrote below program in Ardunio, but the output is not stopping, Its keepon sending the text to my computer.
Please give me a program for "when USB plugin that time only one time Text transfer to PC for unlock the computer"

#include "DigiKeyboard.h"
void setup() {
}
void loop() {
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.print("My Password");
DigiKeyboard.delay(5000);
}

The loop function repeats over and over. The setup function runs once. If you want something to run once, which function do you think you should put that in?

Anything in the loop() function gets executed repeatedly. Anything in the setup() function gets executed once, prior to the first execution of the loop() function.

Your code probably needs to look more like this:

#include "DigiKeyboard.h"
void setup() {
  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.print("My Password");
}
void loop() {
}

I tried this code....

for this code
Digispark not give any output

Didn't give any output? Or it happened too fast to be caught? Maybe you need to delay for a bit before you send the keystrokes.

Hi,
Thanks..... Its works now.

Would you mind posting the code that works?