首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将代码转换为python

将代码转换为python
EN

Stack Overflow用户
提问于 2011-06-27 05:36:58
回答 1查看 382关注 0票数 0

我目前正在学习python,这是我感兴趣的那种项目。我不知道脚本是哪种语言编写的(可能是lisp或autohotkey?),但我想将它转换为python。请你指出正确的方向,然后告诉我

  • 这是用什么语言做的?
  • 我需要学些什么来转换它?

谢谢!

代码语言:javascript
运行
复制
; Thois TableOpener for PokerStars v1.05
; Opens new cash game tables from the lobby every x seconds (if there are  less tables opened than your predefined settings). A great tool for multi-tablers.
; Customize the variables below (between the lines)
; 'Thois' on PS for donations

; Customizable variables (between the lines)
;------------------------------------------
rowheight := 13 ;In the PokerStars lobby go to View > Text Size: For Medium & smaller:13, For smallest:12, For Larger:15, For Largest:17
recheck := 50 ;How often the script should open up new tables (if needed),     50=10seconds, 25=5seconds etc... Try not to set this too low for CPU performance issues
;------------------------------------------

Gui, Font, s8, Arial
Gui, Add, Text,, Number Of Tables:
Gui, Add, Edit
Gui, Add, UpDown, vnumberoftablestokeepopen Range1-24, 12
Gui, Add, Checkbox, venabledisable, Run!
Gui, Show,, Thois TableOpener for PokerStars v1.00
Gui, Submit, NoHide

numberofloopinstances := recheck - 1

Loop
{
Gui, Submit, NoHide
SendMessage, 0x115, 0, 0, PokerStarsListClass1, PokerStars Lobby
numberofloopinstances := numberofloopinstances + 1
if (numberofloopinstances = recheck)
    {
    numberofloopinstances := 0
    WinGet, numberofwindows, Count, ahk_class PokerStarsTableFrameClass,,Lobby
    beffen := numberoftablestokeepopen - numberofwindows
    if (beffen > 0 AND enabledisable = 1)
        {
        Loop
            {
            ControlGet, tablesinthelobby, Hwnd, , PokerStarsListClass1, PokerStars Lobby
            yclick := 1 + (rowheight * A_Index) - rowheight
            PostLeftClick(1, yclick, tablesinthelobby)
            ControlClick, PokerStarsButtonClass10, PokerStars Lobby
            Sleep, 500
            WinGet, numberofwindows, Count, ahk_class PokerStarsTableFrameClass,,Lobby
            beffen := numberoftablestokeepopen - numberofwindows
            if (beffen = 0)
                {
                break
                }
            }
        }
    }
Sleep, 200
}

; Hotkeys (disabled)

;~Xbutton1:: ;Endlessly cycles between all tables in the stack the cursor is pointing at (brings the front table to the back), disabled (remove ; marks to enable)
;MouseGetPos,,,tableID
;WinGetClass, classoftableid, ahk_id %tableID%
;if (classoftableid = "PokerStarsTableFrameClass")
;   {
;   WinSet, Bottom,, ahk_id %tableID%
;   }
;return

;~Xbutton2:: ;Closes the table the mouse is pointing at (also clicks the OK warning button), disabled (remove ; marks to enable)
;MouseGetPos,,,tableID
;WinGetClass, classoftableid, ahk_id %tableID%
;if (classoftableid = "PokerStarsTableFrameClass");
;   {
;   WinClose, ahk_id %tableID%
;   Sleep,20
;   ControlClick, Button1, Table, OK
;   }
;return

;Juks rocks - I deactivated WinActivate so that the Lobby doesnt steal focus
PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
; WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}

GuiClose:
ExitApp
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-06-27 08:06:55

这无疑是AutoHotKey。您需要将其转换为:

  1. 对AutoHotKey有足够的理解,能够理解程序所做的事情。
  2. 对Python有足够的理解,能够重新创建程序所做的工作。

您应该注意到,AutoHotKey和Python非常不同。AutoHotKey是一个自动化鼠标和键盘,以控制其他程序的软件。使用Python当然可以做到这一点,但是您的方式取决于环境。如果没有外部库来帮助您,您可能无法做到这一点,因为Python是一种编写程序的语言,而不是用来控制现有程序的语言。

所以我怀疑你的转化努力是否值得。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6488977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档