Innerhalb einer Schleife, Tasten abfragen

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Innerhalb einer Schleife, Tasten abfragen

Re: Innerhalb einer Schleife, Tasten abfragen

Post by KHA » 13 Apr 2019, 16:47

Danke dir, hat wunderbar funktioniert.

Re: Innerhalb einer Schleife, Tasten abfragen

Post by wolf_II » 13 Apr 2019, 12:07

Versuch mal:

Code: Select all

mydat=
(join`r`n
Gelb
Banane
Grün
Apfel
Kiwi
Grün
)

Loop, parse, mydat, `n
{
    msgbox, 36,, % A_LoopField

    IfMsgBox, Yes
        FileAppend, %A_LoopField%, Obst.txt

    else
        FileAppend, %A_LoopField%, Farbe.txt
}


Left:: ControlSend, , Y, ahk_class #32770
right:: ControlSend, , N, ahk_class #32770
Ich hoffe das hilft.

Innerhalb einer Schleife, Tasten abfragen

Post by KHA » 13 Apr 2019, 11:48

Hallo,
wie kann ich innerhalb einer schleife tasten abfragen?
in meinem Beispiel, habe eine Liste bestehend aus Obst und Farben.
Wenn ich die Linke Taste drücke, soll es in datei obst.txt gespeichert werden und wenn ich die rechte taste drücke dann in Datei Farbe.txt
LG

Code: Select all

mydat=
(join`r`n
Gelb
Banane
Grün
Apfel
Kiwi
Grün
)

Loop, parse, mydat, `n
{
msgbox, % A_LoopField
Left::
;If GetKeyState("Left", "P")
FileAppend, %A_LoopField%, Obst.txt
return

right::
;If GetKeyState("Right", "P")
FileAppend, %A_LoopField%, Farbe.txt
return
}

Top