Script for setting home page not working

Hi everyone,

I am trying to create a script for changing various registry keys such as the web browser home page. This script contains the string to change that for Internet Explorer, but I cannot figure out how to ensure that the \s do not confuse the script so to speak. It recognises it as a command rather than the string I would like it to type. Any help would be much appreciated! Thanks

#include "DigiKeyboard.h"

void setup() {
    DigiKeyboard.delay(5000);  // Wait 5 seconds before proceeding
}

int limit = 1;
int current = 0;

void loop() {
    DigiKeyboard.update();

    if (current < limit) {
        DigiKeyboard.sendKeyStroke(0);

        DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
        DigiKeyboard.delay(100);
        DigiKeyboard.println("cmd.exe");
        DigiKeyboard.delay(500);
        DigiKeyboard.println("REG ADD "HKCU\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /t REG_SZ /d http://www.google.co.uk /f");
        current++;
    }

    DigiKeyboard.delay(5000);
}
[/code]

You have to escape those quotes and path separators with \

DigiKeyboard.println("REG ADD \"HKCU\\Software\\Microsoft\\Internet Explorer\\Main" /v \"Start Page\" /t REG_SZ /d http://www.google.co.uk /f");

Thank you! That has ensured that Arduino has recognised it as a string now, but when I run the script, I get this entered into cmd:

REG ADD @HKCU#Software#Microsoft#Internet Explorer#Main/v @Start Page@ /t REG_SZ /d http://www.google.co.uk /f

Is your system, perhaps, not using the US keyboard layout? I expect the DigiKeyboard library, like the Keyboard library, sends key presses appropriate for the US keyboard. It looks like the US key that has the " on it produces and @ and the US key that has a '' on it produces a '#'.

What keyboard layout are you using on your Windows machine?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.