Image

Creative laboratory → Type a message in notepad

#Arduino #Windows #Automation #Scetches
Date of publication: 20.05.2024

Type a message in notepad

The script opens a text editor in the Windows operating system and prints the specified text.

#if ARDUINO > 10605
#include <Keyboard.h>
#endif

void typeKey(uint8_t key)
{
	Keyboard.press(key);
	delay(50);
	Keyboard.release(key);
}

/* Init function */
void setup()
{
	// Begining the Keyboard stream
	Keyboard.begin();
	
	//Wait 500ms
	delay(500);
	
	Keyboard.press(KEY_LEFT_GUI);
	Keyboard.press('r');
	Keyboard.releaseAll();
	
	delay(500);
	
	Keyboard.print("notepad.exe");
	
	typeKey(KEY_RETURN);
	
	delay(1000);
	
	Keyboard.print("This is my test text.");
	
	// Ending stream
	Keyboard.end();
}

/* Unused endless loop */
void loop() {}




No Comments Yet