1

Тема: Проблемы с кодировкой.

Имеется скрипт:


setkeydelay, -1
setmousedelay, 0

IniRead, PathExe, LSettings.ini, Path, Exe
IniRead, PathRealmlist, LSettings.ini, Path, Realmlist
Fileread, Realm, %PathRealmlist%
IniRead, Posx, LSettings.ini, Pos, Posx
IniRead, Posy, LSettings.ini, Pos, Posy
IniRead, Runcolor, LSettings.ini, Color, Color
IniRead, AmA, LSettings.ini, Accounts, Amount
IniRead, Current_Select, LSettings.ini, Accounts, Current_Select

N:=1
loop %AmA%
{
IniRead, Acc%N%, LSettings.ini, Accounts, Acc%N%
IniRead, Pas%N%, LSettings.ini, Accounts, Pas%N%
N+=1
}


Gui1:
gui,1: -sysmenu -toolwindow
Gui,1: Add, Text, x2 y0 w160 h30 +Center, Current Realmlist
Gui,1: Add, Text, x2 y30 w160 h40 , %Realm%
Gui,1: Add, Button, x2 y70 w80 h30 , Change
Gui,1: Add, Button, x82 y70 w80 h30 , Copy
Gui,1: Add, Text, x2 y100 w160 h20 +Center, Select account
Gui,1: Add, DropDownList, x2 y120 w160  vCSA Choose%Current_Select% , %Acc1%|%Acc2%
Gui,1: Add, Button, x2 y140 w80 h30 , Run account
Gui,1: Add, Button, x82 y140 w80 h30 , Simply wow
Gui,1: Add, Button, x2 y170 w80 h30 , Settings
Gui,1: Add, Button, x82 y170 w80 h30 , Exit
Gui,1: Show, x466 y188 h207 w167, WoW autologin
Return

GuiClose:
ExitApp
ButtonExit:
Exitapp
return

ButtonChange:
Run, %PathRealmlist%
Exitapp
ButtonSettings:
Run, LSettings.ini
Exitapp
ButtonCopy:
Clipboard = %Realm%
Return
ButtonSimplywow:
run, %PathExe%
Exitapp
ButtonRunaccount:
gui, submit, nohide
N:= 1
loop %AmA%
{
Tempvar1:= Acc%N%
 if Tempvar1 = %CSA%
 {
 goto, Logacc
 }
N+=1
}
Return

Logacc:
Tempvar2:= Pas%N%
IniWrite, %N%, LSettings.ini, Accounts, Current_Select
gui, hide
run, %PathExe%
winwait World of Warcraft
winactivate World of Warcraft
loop
{
pixelgetcolor, CColor, %posx%, %posy%
 if CColor = %Runcolor%
 {
 send %Tempvar1% {tab} %Tempvar2% {Enter}
 Exitapp
 }
}

Он работает, но игра логин не распознает. Причем при попытке заставить скрипт вместо %Tempvar1% послать просто нужную комбинацию клавиш, заканчивается тем же.
Скрипт и .ini  - ANSI,  билд программы ahk_l v1.1.10.01. При попытке сменить на юникод, оно перестает читать переменные вовсе.

Примечательно что старый скрипт с "Filereadline" вполне себе работает. Оба файла так же в ANSI.

Вот сам .ini:


[Path]
Exe="D:\games\World of Warcraft\World of Warcraft\WoW.exe"
Realmlist="D:\games\World of Warcraft\World of Warcraft\Data\ruRU\realmlist.wtf"
[Pos]
PosX=622
PosY=515
[color]
Color=0x895118
[Accounts]
Amount=2
Current_Select=1

Acc1=login1
Pas1=123456

Acc2=login2
Pas2=123456

Acc3=
Pas3=

Acc4=
Pas4=

2

Re: Проблемы с кодировкой.

А что именно вы меняли на юникод? Если файлы юникодные, то и АНК тоже должен быть юникодный.

3

Re: Проблемы с кодировкой.

Билд стоит юникодовый. Менял на ANSI, не помогло. Пробовал разные комбинации кодировок, опять ничего...
Самое смешное что вот этот ужас  все посылает правильно, файлы ANSI,  билд AHK - юникод.


setkeydelay, 0
setmousedelay, 0


fileread, pathwow, C:\pathwow
 if errorlevel
 {
 fileselectfolder, pathwow,,0, wow folder
 filedelete, C:\pathwow
 fileappend, %pathwow% , C:\pathwow
 }
 
ifnotexist, C:\accounts
{
fileappend, 
(
login1=
%log1%
password1=
%pas1%
login2=
%log2%
password2=
%pas2%
login3=
%log3%
password3=
%pas3%
login4=
%log4%
password4=
%pas4%
) , c:\accounts
}

filereadline, log1, C:\Accounts, 2
filereadline, pas1, C:\Accounts, 4
filereadline, log2, C:\Accounts, 6
filereadline, pas2, C:\Accounts, 8
filereadline, log3, C:\Accounts, 10
filereadline, pas3, C:\Accounts, 12
filereadline, log4, C:\Accounts, 14
filereadline, pas4, C:\Accounts, 16 

fileread, currrealm, %pathwow%\Data\ruRU\realmlist.wtf
;GUI 1
gui,1: -sysmenu
gui,1: -toolwindow
gui,1: add, text, x4 y2 w180 h30 +center, Current Realm
gui,1: add, edit, x4 y32 w180 h70  +ReadOnly , %Currrealm%
gui,1: add, button, x4 y102 w90 h50 , Change `r realm
gui,1: add, button, x94 y102 w90 h50 , Copy to `r Clipboard
gui,1: add, text, x4 y152 w180 h30 +center, Accounts
gui,1: add, button, x4 y182 w90 h50 , Account 1
gui,1: add, button, x94 y182 w90 h50 , Account 2
gui,1: add, button, x4 y232 w90 h50 , Account 3
gui,1: add, button, x94 y232 w90 h50 , Account 4
gui,1: add, button, x4 y282 w180 h30 , Edit accounts
gui,1: add, button, x4 y352 w180 h30 , Exit
gui,1: show,, Autologin


;GUI 2
gui, 2: +owner1
gui, 2: -sysmenu
gui, 2: -toolwindow
gui, 2: add, edit, x4 y2 w200 h60 +Left vnewrealm, %currrealm%
gui, 2: add, button, x4 y62 w200 h30 , Accept
return

;EXIT

guiclose:
exitapp
return

buttonexit:
exitapp
return

;COPY REALM
buttoncopytoclipboard:
clipboard = %currrealm%
return 

;CHANGE REALM


buttonchangerealm:
gui, 1: hide
gui, 2:destroy
gui, 2: +owner1
gui, 2: -sysmenu
gui, 2: -toolwindow
gui, 2: add, edit, x4 y2 w200 h60 +Left vnewrealm, %currrealm%
gui, 2: add, button, x4 y62 w200 h30 , Accept
gui, 2: Show,, Enter new realmlist
Return

2buttonaccept:
gui,2: submit
filedelete, %pathwow%\Data\ruRU\realmlist.wtf
fileappend, %newrealm% ,%pathwow%\Data\ruRU\realmlist.wtf
fileread, currrealm, %pathwow%\Data\ruRU\realmlist.wtf
gui,1: destroy


gui,1: -sysmenu
gui,1: -toolwindow
gui,1: add, text, x4 y2 w180 h30 +center, Current Realm
gui,1: add, edit, x4 y32 w180 h70 +center +ReadOnly, %Currrealm%
gui,1: add, button, x4 y102 w90 h50 , Change `r realm
gui,1: add, button, x94 y102 w90 h50 , Copy to `r Clipboard
gui,1: add, text, x4 y152 w180 h30 +center, Accounts
gui,1: add, button, x4 y182 w90 h50 , Account 1
gui,1: add, button, x94 y182 w90 h50 , Account 2
gui,1: add, button, x4 y232 w90 h50 , Account 3
gui,1: add, button, x94 y232 w90 h50 , Account 4
gui,1: add, button, x4 y282 w180 h30 , Edit accounts
gui,1: add, button, x4 y352 w180 h30 , Exit
gui,1: show,, Autologin 0.9
return

;EDIT ACCOUNTS
buttoneditaccounts:

FileReadLine, log1, C:\Accounts, 2
FileReadLine, pas1, C:\Accounts, 4
FileReadLine, log2, C:\Accounts, 6
FileReadLine, pas2, C:\Accounts, 8
FileReadLine, log3, C:\Accounts, 10
FileReadLine, pas3, C:\Accounts, 12
FileReadLine, log4, C:\Accounts, 14
FileReadLine, pas4, C:\Accounts, 16


gui,1: hide
gui, 3: destroy
gui, 3: -sysmenu
gui, 3: -toolwindow
gui, 3: Add, Text, x4 y2 w340 h30 +Center, Edit Accounts
gui, 3: Add, Text, x4 y32 w340 h20 +Center, Account 1
gui, 3: Add, Edit, x174 y72 w170 h20 vpas1, %pas1%
gui, 3: Add, Text, x4 y52 w170 h20 +Center, Login
gui, 3: Add, Text, x174 y52 w170 h20 +Center, Password
gui, 3: Add, Text, x4 y92 w340 h20 +Center, Account 2
gui, 3: Add, Text, x4 y152 w340 h20 +Center, Account 3
gui, 3: Add, Text, x4 y212 w340 h20 +Center, Account 4
gui, 3: Add, Text, x4 y112 w170 h20 +Center, Login
gui, 3: Add, Text, x174 y112 w170 h20 +Center, Password
gui, 3: Add, Edit, x4 y132 w170 h20 vlog2, %log2%
gui, 3: Add, Edit, x174 y132 w170 h20 vpas2, %pas2%
gui, 3: Add, Edit, x4 y72 w170 h20 vlog1, %log1%
gui, 3: Add, Text, x4 y172 w170 h20 +Center, Login
gui, 3: Add, Text, x174 y172 w170 h20 +Center, Password
gui, 3: Add, Edit, x4 y192 w170 h20 vlog3, %log3%
gui, 3: Add, Edit, x174 y192 w170 h20 vpas3, %pas3%
gui, 3: Add, Text, x4 y232 w170 h20 +Center, Login
gui, 3: Add, Text, x174 y232 w170 h20 +Center, Password
gui, 3: Add, Edit, x4 y252 w170 h20 vlog4, %log4%
gui, 3: Add, Edit, x174 y252 w170 h20 vpas4, %pas4%
gui, 3: Add, Button, x124 y272 w100 h30 , Save
gui, 3: Show, x452 y157 h305 w350, Edit Accounts
Return

3buttonsave:
gui,3: submit
filedelete, c:\Accounts
fileappend, 
(
login1=
%log1%
password1=
%pas1%
login2=
%log2%
password2=
%pas2%
login3=
%log3%
password3=
%pas3%
login4=
%log4%
password4=
%pas4%
) , c:\accounts
gui, 1: show
return
;START GAME
buttonaccount1:
gui, 1:hide
CurrentAccount = %log1%{tab}%pas1%{enter}
run, %pathwow%\WoW.exe
winactivate World of Warcraft
winwait World of Warcraft
loop
{
pixelgetcolor, color1,622, 515
 if color1 = 0x895118
 {
 send %CurrentAccount%
 break
 }
}
exitapp

buttonaccount2:
gui, 1:hide
CurrentAccount = %log2%{tab}%pas2%{enter}
run, %pathwow%\WoW.exe
winactivate World of Warcraft
winwait World of Warcraft
loop
{
pixelgetcolor, color1,622, 515
 if color1 = 0x895118
 {
 send %CurrentAccount%
 break
 }
}
exitapp

buttonaccount3:
gui, 1:hide
CurrentAccount = %log3%{tab}%pas3%{enter}
run, %pathwow%\WoW.exe
winactivate World of Warcraft
winwait World of Warcraft
loop
{
pixelgetcolor, color1,622, 515
 if color1 = 0x895118
 {
 send %CurrentAccount%
 break
 }
}
exitapp


buttonaccount4:
gui, 1:hide
CurrentAccount = %log4%{tab}%pas4%{enter}
run, %pathwow%\WoW.exe
winactivate World of Warcraft
winwait World of Warcraft
loop
{
pixelgetcolor, color1,622, 515
 if color1 = 0x895118
 {
 send %CurrentAccount%
 break
 }
}
exitapp

Не пойму, что ему не нравится...

4

Re: Проблемы с кодировкой.

 send %Tempvar1% {tab} %Tempvar2% {Enter}

Уберите пробелы между переменными и tab и enter.

5

Re: Проблемы с кодировкой.

Ох...   Как-то упустил такое... Все работает. Спасибо.

И да, чтобы не создавать еще 1 лишнюю тему, спрошу тут.
Как сделать переменную, такого вида,  динамичской, т.е. чтобы она постоянно брала данные из Hp1 и Dps1, которые нормально меняются?

Mpb1:=Hp1*Dps1


так не выходит


settimer, UpdateGUI, 50
gosub, UpdateGUI
...
UpdateGUI:
GuiControl,, Mpb1, %Mpb1%

Хотя с остальными переменными сработало.

6

Re: Проблемы с кодировкой.

Что-то не пойму задачу. Что значит "нормально меняются"? Что это за переменные Hp1 и Dps1? И в чём проявляется неработа?

7

Re: Проблемы с кодировкой.

Есть переменные

Hp1 =  10
Dps1 = 2
Mpb1:= Hp1*Dps1

При этом Mpb1 отображает 20

Как сделать так, чтобы после изменения значений например на

Hp1 =  20
Dps1 = 5

Mpb1 тоже изменилось на правильный ответ ?


SetTimer, UpdateGUI, 50
Gosub, UpdateGUI


UpdateGUI:

GuiControl,, HP1, %HP1%
GuiControl,, Dps1, %Dps1%
GuiControl,, Mpb1, %Mpb1%

Обновляет переменные хп и дпс, но  мпб так и остается 20.
Пробовал так же добавлять

GuiControl,, Mpb1:= Hp1*Dps1 

Вместо

GuiControl,, Mpb1, %Mpb1%

Но не срабатывает.

8 (изменено: Mikki, 2013-06-04 20:30:46)

Re: Проблемы с кодировкой.

Как сделать так, чтобы после изменения значений например на
....
Mpb1 тоже изменилось на правильный ответ ?

Переприсвоить переменную

SetTimer, UpdateGUI, 50
Gosub, UpdateGUI


UpdateGUI:

GuiControl,, HP1, %HP1%
GuiControl,, Dps1, %Dps1%
Mpb1:= Hp1*Dps1
GuiControl,, Mpb1, % Mpb1
Жизнь стоит того чтобы не быть сволочью. (с) Разные Люди

9

Re: Проблемы с кодировкой.

Все, спасибо, вопросов больше нет.