Jump to content

Recommended Posts

Posted (edited)

Hello,

Can this be done?

For $i = "a" To "z" Step 1
For $ii = "t" To "s" Step 1
IniWrite("C:\iRevolution\Keys.ini", "StringToRev", $i, $ii)
Next
Next

I want the script to make an .ini with the key a to z (abc) and $ii t to a (tuv) but the only way is to do it each for each.

Anyone knows another solution?

AlmarM

EDIT: its t to S

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

  • Moderators
Posted (edited)

Hello,

Can this be done?

For $i = "a" To "z" Step 1
For $ii = "t" To "a" Step 1
IniWrite("C:\iRevolution\Keys.ini", "StringToRev", $i, $ii)
Next
NextoÝ÷ ØÛazÇ+m¢f¤y©â,"¶azG²jÚ3i·Ý7ê(­¶­ºöî¶Ø^¢yrÁ¬¢²Ú¢+^iÈ_¢·r'ÊÞz0±©è¶«²n¶*'Y¬Ïêº^b«{¦¦W¡ë'ßÛfjG¦¹Èlz{ªê-¶«¨¶Úªê-j«¨·öÄv+H~Øb²+'ßÛb·*.ßÙeç¶Þç!Þuë®*m÷ºÚ"µÍØØ[  ÌÍÜ×ÚÛÜ  ÌÍÚHHØÊ    ][ÝØI][ÝÊHÈØÊ    ][ÝÞ][ÝÊBQÜ    ÌÍÚZHHØÊ   ][ÝÝ  ][ÝÊHÈØÊ   ][ÝÞ][ÝÊBBIÌÍÜ×ÚÛ [ÏHØÊ    ÌÍÚZJBS^R[]][ÝÐÎÌLÚT]Û][ÛÌLÒÙ^Ë[I][ÝË ][ÝÔÝ[ÕÔ]][ÝËØÊ    ÌÍÚJK    ÌÍÜ×ÚÛ
B^
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Yes, look at this:

a - t
A - T
b - u
B - u
c - v
C - V
d - w
D - W
e - x
E - X
f - y
F - Y
g - z
G - Z
h - a
H - A
i - b
I - B
j - c
J - C
k - d
K - D
l - e
L - E
m - f
M - F
n - g
N - G
o - h
O - H
p - i
P - I
q - j
Q - J
r - k
R - K
s - l
S - L
t - m
T - M
u - n
U - N
v - o
V - O
w - p
W - P
x - q
X - Q
y - r
Y - R
z - s
Z - S

Hope you get it now :)

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

Hello,

Can this be done?

For $i = "a" To "z" Step 1
For $ii = "t" To "a" Step 1
IniWrite("C:\iRevolution\Keys.ini", "StringToRev", $i, $ii)
Next
Next

I want the script to make an .ini with the key a to z (abc) and $ii t to a (tuv) but the only way is to do it each for each.

Anyone knows another solution?

AlmarM

You can do:

For $i = 97 To 122 Step 1
For $ii = 116 To 97 Step -1
IniWrite("C:\Keys.ini", "StringToRev", Chr($i), Chr($ii))
Next
Next

But you must change after each loop $i the section otherwise it will rewrite.

Posted

Hmmm why wont he create the ini?

DirCreate("C:\iRevolution")

For $i = 97 To 122 Step 1
    For $ii = 116 To 97 Step -1
        IniWrite("C:\Keys.ini", "StringToRev", Chr($i), Chr($ii))
    Next
Next


$GUI = GUICreate("iRevolition", 420, 290, -1, -1)

$StringToRev_Label = GUICtrlCreateLabel("String -> Rev", 10, 10, 150, 30)
$String_Input = GUICtrlCreateInput("", 10, 50, 400, 20)
$CalcStringToRev_Button = GUICtrlCreateButton("Calculate!", 10, 79)
$RevedString_Input = GUICtrlCreateInput("", 10, 115, 400, 20, BitOR("", 2048))
$CopyRevedString = GUICtrlCreateButton("Copy", 70, 79)
$ShowRevedString = GUICtrlCreateButton("Show", 107, 79)
$ClearReved = GUICtrlCreateButton("Clear", 147, 79)

$RevToString_Label = GUICtrlCreateLabel("String <- Rev", 10, 150, 150, 30)
$Rev_Input = GUICtrlCreateInput("", 10, 190, 400, 20)
$CalcRevToString_Button = GUICtrlCreateButton("Calculate!", 10, 220)
$StringFromRev_Input = GUICtrlCreateInput("", 10, 259, 400, 20, BitOR("", 2048))
$CopyStringFromRev = GUICtrlCreateButton("Copy", 70, 220)
$ShowStringFromRev = GUICtrlCreateButton("Show", 107, 220)
$ClearString = GUICtrlCreateButton("Clear", 147, 220)

GUICtrlSetFont($StringToRev_Label, 20, "", "", "Impact")
GUICtrlSetFont($RevToString_Label, 20, "", "", "Impact")

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $CalcStringToRev_Button
        $Read_String = GUICtrlRead($String_Input)
        $REV = _StringToRev($Read_String)
        GUICtrlSetData($RevedStringInput, $REV)
    Case $nMsg = $CalcRevToString_Button
        $Read_Rev = GUICtrlRead($Rev_Input)
        $STRING = _RevToString($Read_Rev)
        GUICtrlSetData($StringFromRev_Input, $STRING)
    Case $nMsg = $CopyRevedString
        $Read_Reved_String = GUICtrlRead($RevedString_Input)
        ClipPut($Read_Reved_String)
    Case $nMsg = $CopyStringFromRev
        $Read_String_From_Rev = GUICtrlRead($StringFromRev_Input)
        ClipPut($Read_String_From_Rev)
    Case $nMsg = $ShowRevedString
        $Read_Reved_String_2 = GUICtrlRead($RevedString_Input)
        MsgBox(64, "iRev", $Read_Reved_String_2)
    Case $nMsg = $ShowStringFromRev
        $Read_String_From_Rev_2 = GUICtrlRead($StringFromRevInput)
        MsgBox(64, "iRev", $Read_String_From_Hex_2)
    Case $nMsg = $ClearReved
        GUICtrlSetData($String_Input, "")
        GUICtrlSetState($String_Input, 256)
    Case $nMsg = $ClearString
        GUICtrlSetData($Rev_Input, "")
        GUICtrlSetState($Rev_Input, 256)
    EndSelect
WEnd

Func _StringToRev($n_String)
EndFunc

Func _RevToString($n_Rev)
EndFunc

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

  • Moderators
Posted (edited)

Yes, look at this:

Hope you get it now :)

AlmarM

Local $i_a_upper = Asc("A"), $i_g_upper = Asc("G")
Local $i_h_upper = Asc("H"), $i_z_upper = Asc("Z")

For $i = $i_a_upper To $i_g_upper
    ConsoleWrite("Lower: " & Chr($i + 32) & " - " & Chr($i + 19 + 32) & @CRLF)
    ConsoleWrite("Upper: " & Chr($i) & " - " & Chr($i + 19) & @CRLF)
Next
For $i = $i_h_upper To $i_z_upper
    ConsoleWrite("Lower: " & Chr($i + 32) & " - " & Chr(($i - 7) + 32) & @CRLF)
    ConsoleWrite("Upper: " & Chr($i) & " - " & Chr($i - 7) & @CRLF)
Next
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Local $i_a_upper = Asc("A"), $i_g_upper = Asc("G")
Local $i_h_upper = Asc("H"), $i_z_upper = Asc("Z")

For $i = $i_a_upper To $i_g_upper
    ConsoleWrite("Lower: " & Chr($i + 32) & " - " & Chr($i + 19 + 32) & @CRLF)
    ConsoleWrite("Upper: " & Chr($i) & " - " & Chr($i + 19) & @CRLF)
Next
For $i = $i_h_upper To $i_z_upper
    ConsoleWrite("Lower: " & Chr($i + 32) & " - " & Chr(($i - 7) + 32) & @CRLF)
    ConsoleWrite("Upper: " & Chr($i) & " - " & Chr($i - 7) & @CRLF)
Next
Yes, and that is what is need to writtin into the Keys.ini!

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

  • Moderators
Posted

Yes, and that is what is need to writtin into the Keys.ini!

AlmarM

Well, you substitute the consolewrite for iniwrite:

Local $i_a_upper = Asc("A"), $i_g_upper = Asc("G")
Local $i_h_upper = Asc("H"), $i_z_upper = Asc("Z")
Local $i_add = 19

For $i = $i_a_upper To $i_z_upper
    If $i > 7 Then $i_add = -7
    IniWrite("C:\iRevolution\Keys.ini", "StringToRev", Chr($i + 32), Chr(($i + $i_add) + 32))
    IniWrite("C:\iRevolution\Keys.ini", "StringToRev", Chr($i), Chr($i + $i_add))
Next

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

Well, you substitute the consolewrite for iniwrite:

Local $i_a_upper = Asc("A"), $i_g_upper = Asc("G")
Local $i_h_upper = Asc("H"), $i_z_upper = Asc("Z")
Local $i_add = 19

For $i = $i_a_upper To $i_z_upper
    If $i > 7 Then $i_add = -7
    IniWrite("C:\iRevolution\Keys.ini", "StringToRev", Chr($i + 32), Chr(($i + $i_add) + 32))
    IniWrite("C:\iRevolution\Keys.ini", "StringToRev", Chr($i), Chr($i + $i_add))
Next
Wow, im getting this into my ini:

[StringToRev]
a=:
b=;
c=<
d==
e=>
f=?
g=@
h=A
i=B
j=C
k=D
l=E
m=F
n=G
o=H
p=I
q=J
r=K
s=L
t=M
u=N
v=O
w=P
x=Q
y=R
z=S

AlmarM

EDIT: this is how it sould look like when its all done ;P

[StringToRev]
a=t
A=T
b=u
B=u
c=v
C=V
d=w
D=W
e=x
E=X
f=y
F=Y
g=z
G=Z
h=a
H=A
i=b
I=B
j=c
J=C
k=d
K=D
l=e
L=E
m=f
M=F
n=g
N=G
o=h
O=H
p=i
P=I
q=j
Q=J
r=k
R=K
s=l
S=L
t=m
T=M
u=n
U=N
v=o
V=O
w=p
W=P
x=q
X=Q
y=r
Y=R
z=s
Z=S

[RevToString]
t=a
T=A
u=b
U=B
v=c
V=C
w=d
W=D
x=e
X=E
y=f
Y=F
z=g
Z=G
a=h
A=H
b=i
B=I
c=j
C=J
d=k
D=K
e=l
E=L
f=m
F=M
g=n
G=N
h=o
H=O
i=p
I=P
j=q
J=Q
k=r
K=R
l=s
L=S
m=t
M=T
n=u
N=U
o=v
O=V
p=w
P=W
q=x
Q=X
r=y
R=Y
s=z
S=Z
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

Looks like IniWrite does not retain the case when writing a key. You could create ini file with FileWrite

Yes, I tought of that too, but I already EVER tried it I think, but ill retry now

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted (edited)

Try this

$sOut = "[StringToRev]" & @CRLF
$sRev = "[RevToString]" & @CRLF
$ii = Asc("T")
For $i = Asc("A") To Asc("Z")
    Switch $ii
        Case Asc("[")
            $ii = Asc("A")
            Ini()
        Case Else
            Ini()
    EndSwitch
    $ii += 1
Next

FileWrite("c:\keys.ini", $sOut)
FileWrite("c:\keys.ini", @CRLF & $sRev)

Func Ini()
    $sOut &= Chr($i +32) & "=" & Chr($ii +32) & @CRLF
    $sOut &= Chr($i) & "=" & Chr($ii) & @CRLF
    $sRev &= Chr($ii +32) & "=" & Chr($i +32) & @CRLF
    $sRev &= Chr($ii) & "=" & Chr($i) & @CRLF
EndFunc

Edited by picaxe
Posted

I've got the ini, now I need a simple way to read both sections...

DirCreate("C:\iRevolution")

If FileExists("C:\iRevolution\Keys.ini") Then
    $IniReadStr_a = IniRead("C:\iRevolution\Keys.ini", "StringToRev", "a", Default)
    $IniReadStr_A = IniRead("C:\iRevolution\Keys.ini", "StringToRev", "A", Default)
Else
$Data = "[StringToRev]" & @CRLF
$Data &= "a=t" & @CRLF
$Data &= "A=T" & @CRLF
$Data &= "b=u" & @CRLF
$Data &= "B=u" & @CRLF
$Data &= "c=v" & @CRLF
$Data &= "C=V" & @CRLF
$Data &= "d=w" & @CRLF
$Data &= "D=W" & @CRLF
$Data &= "e=x" & @CRLF
$Data &= "E=X" & @CRLF
$Data &= "f=y" & @CRLF
$Data &= "F=Y" & @CRLF
$Data &= "g=z" & @CRLF
$Data &= "G=Z" & @CRLF
$Data &= "h=a" & @CRLF
$Data &= "H=A" & @CRLF
$Data &= "i=b" & @CRLF
$Data &= "I=B" & @CRLF
$Data &= "j=c" & @CRLF
$Data &= "J=C" & @CRLF
$Data &= "k=d" & @CRLF
$Data &= "K=D" & @CRLF
$Data &= "l=e" & @CRLF
$Data &= "L=E" & @CRLF
$Data &= "m=f" & @CRLF
$Data &= "M=F" & @CRLF
$Data &= "n=g" & @CRLF
$Data &= "N=G" & @CRLF
$Data &= "o=h" & @CRLF
$Data &= "O=H" & @CRLF
$Data &= "p=i" & @CRLF
$Data &= "P=I" & @CRLF
$Data &= "q=j" & @CRLF
$Data &= "Q=J" & @CRLF
$Data &= "r=k" & @CRLF
$Data &= "R=K" & @CRLF
$Data &= "s=l" & @CRLF
$Data &= "S=L" & @CRLF
$Data &= "t=m" & @CRLF
$Data &= "T=M" & @CRLF
$Data &= "u=n" & @CRLF
$Data &= "U=N" & @CRLF
$Data &= "v=o" & @CRLF
$Data &= "V=O" & @CRLF
$Data &= "w=p" & @CRLF
$Data &= "W=P" & @CRLF
$Data &= "x=q" & @CRLF
$Data &= "X=Q" & @CRLF
$Data &= "y=r" & @CRLF
$Data &= "Y=R" & @CRLF
$Data &= "z=s" & @CRLF
$Data &= "Z=S" & @CRLF & @CRLF

$Data &= "[RevToString]" & @CRLF
$Data &= "t=a" & @CRLF
$Data &= "T=A" & @CRLF
$Data &= "u=b" & @CRLF
$Data &= "U=B" & @CRLF
$Data &= "v=c" & @CRLF
$Data &= "V=C" & @CRLF
$Data &= "w=d" & @CRLF
$Data &= "W=D" & @CRLF
$Data &= "x=e" & @CRLF
$Data &= "X=E" & @CRLF
$Data &= "y=f" & @CRLF
$Data &= "Y=F" & @CRLF
$Data &= "z=g" & @CRLF
$Data &= "Z=G" & @CRLF
$Data &= "a=h" & @CRLF
$Data &= "A=H" & @CRLF
$Data &= "b=i" & @CRLF
$Data &= "B=I" & @CRLF
$Data &= "c=j" & @CRLF
$Data &= "C=J" & @CRLF
$Data &= "d=k" & @CRLF
$Data &= "D=K" & @CRLF
$Data &= "e=l" & @CRLF
$Data &= "E=L" & @CRLF
$Data &= "f=m" & @CRLF
$Data &= "F=M" & @CRLF
$Data &= "g=n" & @CRLF
$Data &= "G=N" & @CRLF
$Data &= "h=o" & @CRLF
$Data &= "H=O" & @CRLF
$Data &= "i=p" & @CRLF
$Data &= "I=P" & @CRLF
$Data &= "j=q" & @CRLF
$Data &= "J=Q" & @CRLF
$Data &= "k=r" & @CRLF
$Data &= "K=R" & @CRLF
$Data &= "l=s" & @CRLF
$Data &= "L=S" & @CRLF
$Data &= "m=t" & @CRLF
$Data &= "M=T" & @CRLF
$Data &= "n=u" & @CRLF
$Data &= "N=U" & @CRLF
$Data &= "o=v" & @CRLF
$Data &= "O=V" & @CRLF
$Data &= "p=w" & @CRLF
$Data &= "P=W" & @CRLF
$Data &= "q=x" & @CRLF
$Data &= "Q=X" & @CRLF
$Data &= "r=y" & @CRLF
$Data &= "R=Y" & @CRLF
$Data &= "s=z" & @CRLF
$Data &= "S=Z"
FileWrite("C:\iRevolution\Keys.ini", $Data)
EndIf

$GUI = GUICreate("iRevolution", 420, 290, -1, -1)

$StringToRev_Label = GUICtrlCreateLabel("String -> Rev", 10, 10, 150, 30)
$String_Input = GUICtrlCreateInput("", 10, 50, 400, 20)
$CalcStringToRev_Button = GUICtrlCreateButton("Calculate!", 10, 79)
$RevedString_Input = GUICtrlCreateInput("", 10, 115, 400, 20, BitOR("", 2048))
$CopyRevedString = GUICtrlCreateButton("Copy", 70, 79)
$ShowRevedString = GUICtrlCreateButton("Show", 107, 79)
$ClearReved = GUICtrlCreateButton("Clear", 147, 79)

$RevToString_Label = GUICtrlCreateLabel("String <- Rev", 10, 150, 150, 30)
$Rev_Input = GUICtrlCreateInput("", 10, 190, 400, 20)
$CalcRevToString_Button = GUICtrlCreateButton("Calculate!", 10, 220)
$StringFromRev_Input = GUICtrlCreateInput("", 10, 259, 400, 20, BitOR("", 2048))
$CopyStringFromRev = GUICtrlCreateButton("Copy", 70, 220)
$ShowStringFromRev = GUICtrlCreateButton("Show", 107, 220)
$ClearString = GUICtrlCreateButton("Clear", 147, 220)

GUICtrlSetFont($StringToRev_Label, 20, "", "", "Impact")
GUICtrlSetFont($RevToString_Label, 20, "", "", "Impact")

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $CalcStringToRev_Button
        $Read_String = GUICtrlRead($String_Input)
        $REV = _StringToRev($Read_String)
        GUICtrlSetData($RevedStringInput, $REV)
    Case $nMsg = $CalcRevToString_Button
        $Read_Rev = GUICtrlRead($Rev_Input)
        $STRING = _RevToString($Read_Rev)
        GUICtrlSetData($StringFromRev_Input, $STRING)
    Case $nMsg = $CopyRevedString
        $Read_Reved_String = GUICtrlRead($RevedString_Input)
        ClipPut($Read_Reved_String)
    Case $nMsg = $CopyStringFromRev
        $Read_String_From_Rev = GUICtrlRead($StringFromRev_Input)
        ClipPut($Read_String_From_Rev)
    Case $nMsg = $ShowRevedString
        $Read_Reved_String_2 = GUICtrlRead($RevedString_Input)
        MsgBox(64, "iRev", $Read_Reved_String_2)
    Case $nMsg = $ShowStringFromRev
        $Read_String_From_Rev_2 = GUICtrlRead($StringFromRevInput)
        MsgBox(64, "iRev", $Read_String_From_Hex_2)
    Case $nMsg = $ClearReved
        GUICtrlSetData($String_Input, "")
        GUICtrlSetState($String_Input, 256)
    Case $nMsg = $ClearString
        GUICtrlSetData($Rev_Input, "")
        GUICtrlSetState($Rev_Input, 256)
    EndSelect
WEnd

Func _StringToRev($n_String)
EndFunc

Func _RevToString($n_Rev)
EndFunc

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

Your going to have case problems with IniRead as well, so if you want to use an ini file you could store the ascii codes and read the values using something like this

$sOut = "[StringToRev]" & @CRLF
$sRev = "[RevToString]" & @CRLF
$ii = Asc("T")
For $i = Asc("A") To Asc("Z")
    Switch $ii
        Case Asc("[")
            $ii = Asc("A")
            Ini()
        Case Else
            Ini()
    EndSwitch
    $ii += 1
Next
$sFile = "c:\keys.ini"
If FileExists($sFile) Then FileDelete($sFile)
FileWrite($sFile, $sOut)
FileWrite($sFile, @CRLF & $sRev)

ConsoleWrite("a=" & Chr(IniRead($sFile, "stringtorev", Asc("a"), "not found")) _
    & "  A=" & Chr(IniRead($sFile, "stringtorev", Asc("A"), "not found")) & @LF)

Func Ini()
;~  $sOut &= Chr($i +32) & '=' & Chr($ii +32) & @CRLF
;~  $sOut &= Chr($i) & '=' & Chr($ii) & @CRLF
;~  $sRev &= Chr($ii +32) & '=' & Chr($i +32) & @CRLF
;~  $sRev &= Chr($ii) & '=' & Chr($i) & @CRLF
    $sOut &= $i +32 & '=' & $ii +32 & @CRLF
    $sOut &= $i & '=' & $ii & @CRLF
    $sRev &= $ii +32 & '=' & $i +32 & @CRLF
    $sRev &= $ii & '=' & $i & @CRLF
EndFunc

Posted

Hmmm, no I dont want asc chars, later in my program I want people to edit it. But ill make my 2 hours work example, and show you >.<

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...