Jump to content
Sign in to follow this  
XxxKills

2 Qestions regarding Ip address and launching game from the gui

Recommended Posts

XxxKills

Hello every one! I'm still a noob to autoit so please be kind lol.

1'st question: how would I write my current IP adress in the topmost bar of my game after useing netstat to collect the info? I cant seem to find what I'm looking for in the help files or by search.

2'nd question: How would I launch a game from my Gui without haveing to press a button to launch it? When I start the script it creates the Gui box as needed, but hangs on the launch/run part till I click on the start button. In other words how would I have It launch the game while creating the Gui and still attach?

I try'd to run the game .exe while creating the Gui but it will not attach that way.

an example of what I have so far.

$Form1 = GUICreate("Diablo II", 798, 601, 223, 100, -1, -1, $GUI_DOCKAUTO)
$Button1 = GUICtrlCreateButton("Start", 680, 10, 25, 15, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUISetState()
#EndRegion ### END Koda GUI section ###
 WinMove("Diablo II", "", 0, 0)
Run("notepad.exe")
WinWait("")
$handle = WinGetHandle("")
XSkinRun($Form1, $handle, 0, 0,1, ($GUI_DOCKAUTO))

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
    Exit
                Case $Button1
        Diablo()
EndSwitch
WEnd


Func Diablo()
    Run("C:\Program Files\Diablo II\Diablo II.exe -w")
    WinWaitActive("Diablo II")

Share this post


Link to post
Share on other sites
XxxKills

Any one? Or am I beating a dead horse here?

Share this post


Link to post
Share on other sites
MDCT

I think it's better to use the macro to get the ip address, instead using Netstat.

Example:

tooltip("Local IP is " & @IPAddress1,0,0)
sleep(3000)

Can't help you on your second question, I've never tried XSkinRun before. But when I tried to run your code, it just flickers my screen until exit.

Good luck.

Share this post


Link to post
Share on other sites
XxxKills

add this at the end:

Func XSkinRun($XPID2, $XhWnd, $X, $Y, $XX, $YY)
    $oxStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $XPID2, "int", -16)
    DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XPID2, "int", -16, "long", BitOR($oxStyle[0], $WS_CLIPCHILDREN))
    $ostyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $XhWnd, "int", -16)
    DllCall("user32.dll", "int", "SetParent", "hwnd", $XhWnd, "hwnd", $XPID2)
    DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $XhWnd, "int", -16, "long", BitOR($WS_POPUP, $WS_CHILD, $WS_VISIBLE, $WS_CLIPSIBLINGS))
    GUISetState()
    WinMove($XhWnd, "", $X, $Y, $XX, $YY)
    WinSetState($XhWnd, "", @SW_SHOW)
    WinActivate($XhWnd)
    Return 1
EndFunc  ;==>XSkinRun

and then retry it.

Share this post


Link to post
Share on other sites
XxxKills

I think it's better to use the macro to get the ip address, instead using Netstat.

Example:

tooltip("Local IP is " & @IPAddress1,0,0)
sleep(3000)

That worked for my local Ip, but Im looking for the one with the 4000 specific at the end.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.