本源码来之autohotkey终极群(470710096)simple
;流放之路自动洗装备 #SingleInstance, off OnExit,OnExit HTML_page = ( Ltrim Join <!DOCTYPE html> <html> <style> .position { width: 50px; } .title_color{ color: red; } </style> <body > <div align="center" style="width: 400px;height: 220px"> <table> <tr> <td colspan="3"><div align="center">设 置</div></td> </tr> <tr> <td class="title_color">通货 F5</td> <td>X :<input class="position" id="th_x" /></td> <td>Y: <input class="position" id="th_y" /></td> </tr> <tr> <td class="title_color">判定点位置 F6</td> <td>X: <input class="position" id="color_x" /></td> <td>Y: <input class="position" id="color_y" /></td> </tr> <tr> <td class="title_color">装备位置偏移量</td> <td>X: <input class="position" id="py_x" /></td> <td>Y: <input class="position" id="py_y" /></td> </tr> <tr> <td colspan="3"><div align="center">判定颜色对比</div></td> </tr> <tr> <td class="title_color" >正确颜色</td> <td colspan="2" style="background-color: #e7b477;" ></td> </tr> <tr> <td class="title_color" >当前颜色</td> <td colspan="2" style="background-color: white;" id="nowColor" ></td> </tr> <tr> <td colspan="3"> <div align="center"> <button id="Save">保存设置</button> </div> </td> </tr> </table> </div> </body> </html> ) ;设置HTML窗体大小 Gui Add, ActiveX, x0 y0 w400 h200 vWB, Shell.Explorer WB.silent := true Display(WB,HTML_page) while WB.readystate != 4 or WB.busy sleep 10 ; 初始化 Save := wb.document.getElementById("Save") ComObjConnect(Save, "Save_") ;读取配置文件 init() ;设置程序窗体大小 Gui Show, w300 h200 return GuiClose: ExitApp OnExit: FileDelete,%A_Temp%\*.DELETEME.html ;clean tmp file ExitApp Save_OnClick() { global wb ;通货 th_x := wb.Document.getElementById("th_x").value th_y := wb.Document.getElementById("th_y").value IniWrite, %th_x%, seting.ini, TH, X IniWrite, %th_y%, seting.ini, TH,Y ;判定点位置 color_x := wb.Document.getElementById("color_x").value color_y := wb.Document.getElementById("color_y").value IniWrite, %color_x%, seting.ini, COLOR, X IniWrite, %color_y%, seting.ini, COLOR,Y ;装备偏移量 py_x := wb.Document.getElementById("py_x").value py_y := wb.Document.getElementById("py_y").value IniWrite, %py_x%, seting.ini, PY, X IniWrite, %py_y%, seting.ini, PY,Y } init(){ global wb IniRead, th_x, seting.ini, TH, X wb.Document.getElementById("th_x").value := th_x IniRead, th_y, seting.ini, TH, Y wb.Document.getElementById("th_y").value := th_y IniRead, color_x, seting.ini, COLOR, X wb.Document.getElementById("color_x").value := color_x IniRead, color_y, seting.ini, COLOR, Y wb.Document.getElementById("color_y").value := color_y IniRead, py_x, seting.ini, PY, X wb.Document.getElementById("py_x").value := py_x IniRead, py_y, seting.ini, PY, Y wb.Document.getElementById("py_y").value := py_y } ;------------------ Display(WB,html_str) { Count:=0 while % FileExist(f:=A_Temp "\" A_TickCount A_NowUTC "-tmp" Count ".DELETEME.html") Count+=1 FileAppend,%html_str%,%f% WB.Navigate("file://" . f) } ;热键 F5::getTH() F6::getColor() getTH(){ MouseGetPos, thisPosX, thisPosY global wb wb.Document.getElementById("th_x").value :=thisPosX wb.Document.getElementById("th_y").value :=thisPosY } getColor() { MouseGetPos, thisPosX, thisPosY PixelGetColor, color, %thisPosX%, %thisPosY%, RGB global wb wb.Document.getElementById("color_x").value :=thisPosX wb.Document.getElementById("color_y").value :=thisPosY a:="#" color wb.Document.getElementById("nowColor").style.backgroundColor:=a MsgBox,%a% }
学到了
非常感谢。。