2017-12-08 35 views
0

이 색상들을 각각 어떻게 반복하여 ctr j를 처음 눌렀을 때 "빨간색"두 번째로 "파란색"등이 나타나게합니다. 이것은 내가 가지고있는 것입니다 나는 그것이 내가 얻을 출력이자동 핫 키의 객체를 통해 반복

greenredgreenredgreenredgreenredgreenred 

답변

1
; Creating an array: 
colors := ["red","blue","green","black"] 
; or: 
; colors := Array("red","blue","green", "black") 

; MaxIndex returns the number of items: 
MaxIndex := colors.MaxIndex() 

^j:: 
    Index++ ; increases the number in the variable "Index" by 1, each time you press ^j. 
    Send, % colors[Index] 
    If (Index = MaxIndex) 
     Index = 0 ; reset 
return 

https://autohotkey.com/docs/Objects.htm#Usage_Simple_Arrays

입니다 실행 그러나 지금까지

^j:: 
colors := Object("red","blue","green", "black") 
for key, in colors 
    s .= key 
Send, % s 
Return 

,