Sonderzeichen mit Inbox einlesen und Ausgeben

  • Guten Morgen Liebe Forencomunity;
    Erstmal Kalsse das es diese Seite gibt! Hat mir schon bei vielen Problemen geholfen (besonders die Dokumentationen).
    Nun stehe ich aber vor einem Problem welches ich seit 2 Tagen nicht lösen konnte und auch nichts gefunden habe bisher ;<
    Folgendes Problem liegt vor:
    Ich lese einen String mit der Inbox ein. Funktioniert ganz gut. Auch die Ausgabe mit Controlsend geht, aber leider verschluckt er zeichen wie # oder das +
    Mein Quellcode:

    [autoit]

    $text = InputBox("Fenster", "PLS String eingeben", "", "", -1, -1, 10, 40)
    ControlSend("Unbenannt - Editor", "", "",$text & "{Enter}")

    [/autoit]


    Ich hoffe ihr könnt mir helfen ;)
    MfG
    /Edit:
    Lösung: (Für die Suche falls andere das Problem auch haben)
    Input Box liest es richtig ein das Problem lag am Controlsend
    Um das Problem zu beheben statt # {#} schreiben und es funktioniert
    Danke an Bugfix für die Hilfe via Shoutbox
    MfG

    Einmal editiert, zuletzt von N8wolf (19. Mai 2009 um 10:34)

  • Ein Blick in die Hilfe bringt die Erklärung:

    Spoiler anzeigen

    '!'
    This tells AutoIt to send an ALT keystroke, therefore Send("This is text!a") would send the keys "This is text" and then press "ALT+a".

    N.B. Some programs are very choosy about capital letters and ALT keys, i.e. "!A" is different to "!a". The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase!

    '+'
    This tells AutoIt to send a SHIFT keystroke, therefore Send("Hell+o") would send the text "HellO". Send("!+a") would send "ALT+SHIFT+a".

    '^'
    This tells AutoIt to send a CONTROL keystroke, therefore Send("^!a") would send "CTRL+ALT+a".

    N.B. Some programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase!

    '#'
    The hash now sends a Windows keystroke; therefore, Send("#r") would send Win+r which launches the Run dialog box.

    Um diese Zeichen zu senden müssen sie wie folgt formatiert werden:

    Send Command (if zero flag) Resulting Keypress
    {!} = !
    {#} = #
    {+} = +
    {^} = ^
    {{} = {
    {}} = }

    Müsstest also den String nach Sonderzeichen durchsuchen und dann entsprechend ersetzen.

    Was anderes fällt mir gerade nicht ein ?(

    Zitat

    Laughing Man

    "I thought, what I'd do was, I'd pretend I was one of those deaf-mutes"

    • Offizieller Beitrag

    Müsstest also den String nach Sonderzeichen durchsuchen und dann entsprechend ersetzen.


    Und das kannst du ganz komfortabel mit einem RegEx machen:

    [autoit]

    Local $input = InputBox('Test', 'Sonderzeichen')
    $input = StringRegExpReplace($input, '[#!^+{}]', '{' & '$0' & '}')
    MsgBox(0, 'String für "Send()"', $input)

    [/autoit]
  • japs!

    kommt aber das Selbe bei raus - zumindest bei meinen Tests mit Send und Controlsend - das hatte ich zuerst getestet 8|

    Zitat

    Laughing Man

    "I thought, what I'd do was, I'd pretend I was one of those deaf-mutes"