Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/30/2014 in all areas

  1. Usually you get IP info by connecting to some site that echoes your IP address. The bad thing about that method is almost proverbial need of site administrators to make changes to sites or their policies requiring from you to frequently update your code. Another issue could be caching thingy of the Inet approach. I did some reading about alternative ways to get public IP, and initially tried with SMTP. This Works great but it's kind of slow and on top of that some ISPs tend to block users on port 25 to prevent spam. Then further reading lead me to STUN protocol documentation. STUN servers are made to resolve and echo users' IP addresses, and are often used by VoIP services. The protocol is extremly simple and everything happens very quickly. Client connects (it's UDP so you Know what Imean), sends request, server replies, client parses the response and IP is there. RFC5389 describes STUN in details, so knock yourself out, if you are that crazy. I have found some implementations written in c++ and c sharp, but OMG, some people are just to stubborn and love to write incomprehensible idiotic hundreds of thousands kilobytes of code for something as simple as STUN. That went nowhere for me and gave me only the pain, so I just fall back to RFC and wrote my own client based on documentation. Function is called STUN_GetMyIP() and you can find example of usage in this little script. It's UDP this and UDP that: STUN.au3 If something wouldn't work, do say.
    3 points
  2. Jon

    AutoIt v3.3.11.6 Beta

    File Name: AutoIt v3.3.11.6 Beta File Submitter: Jon File Submitted: 30 May 2014 File Category: Beta 3.3.11.6 (30th May, 2014) (Beta) AutoIt: - Changed #2718: SplashOff doc example. - Fixed #2717: Appendix constants page precision about Inet Constants. UDFs: - Added: _Array1DToHistogram(). (thanks jchd) - Added #2702: _ArrayTranspose() set @error to 2 if not Array. - Added #2726: Group ID to return array for _GUICtrlListView_GetGroupInfoByIndex(). - Fixed #2701: _ArrayTranspose() doc for 1D Array. - Fixed #2706: $tagWINDOWINFO bad struct. - Fixed #2718: SplashOff doc example. Au3Check: - Fixed: Undetected errors. Others: - Fixed #2725: AutoIt3.chm printing example. Click here to download this file
    2 points
  3. Anarchon, You appear not to have read the Forum rules since you joined. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game launching - and then you will understand why this thread will now be locked. M23
    1 point
  4. Uploaded a new Beta version of Tidy that should fix this. Thanks jos
    1 point
  5. Not fair. I didn't have chance to join in on the second round.
    1 point
  6. Your problem is the declaration $WM_PAINT. Thus WM_PAINT will never called. Remove it and it should work. #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #Include <Misc.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) ; =============================================================================================================================== ; Description ...: Shows how to display a PNG image ; Author ........: Andreas Klein ; Notes .........: ; =============================================================================================================================== ; =============================================================================================================================== ; Global variables ; =============================================================================================================================== Global $hGUI, $hImage1, $hImage2, $hGraphic, $label_cursorinfo, $cursorinfo, $mousepos ; Create GUI $hGUI = GUICreate("Show PNG", 350, 350) $label_cursorinfo = GUICtrlCreateLabel(" ",10,10,290,290) GUICtrlSetState($label_cursorinfo,@SW_HIDE) ;069380767265 ;2178post ;michael102 GUISetState() ; Load PNG image _GDIPlus_StartUp() $hImage1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\win7.png") $hImage2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Rainbow_trout_transparent.png") ; Draw PNG image $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Local $hMatrix = _GDIPlus_MatrixCreate() ; Scale the matrix by 2 (everything will get 2x larger) ;_GDIPlus_MatrixScale($hMatrix, 0.1, 0.1) ;_GDIPlus_GraphicsSetTransform($hGraphic,$hMatrix) ;_GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, 0, 0) ;_GDIPlus_GraphicsDrawImage($hGraphic, $hImage1,5, 5) ; Loop until user exits WM_PAINT() GUIRegisterMsg($WM_PAINT, "WM_PAINT") While 1 ;~ GUICtrlSetState($label_cursorinfo,@SW_HIDE) ;~ $cursorinfo = GUIGetCursorInfo($hGUI) ;~ $mousepos = MouseGetPos() ;~ ;GUICtrlSetData($label_cursorinfo,$cursorinfo[0] & @CRLF & $cursorinfo[1] & @CRLF & $cursorinfo[2] & @CRLF & $cursorinfo[3] & @CRLF & $cursorinfo[4]) ;~ If $cursorinfo[4] = $hImage1 Then ;~ ToolTip("Button Start erreicht!" & @CRLF & "ID: " & $hImage1,$mousepos[0],$mousepos[1]) ;~ Else ;~ ToolTip("X: " & $cursorinfo[0] & @CRLF & "Y: " & $cursorinfo[1] & @CRLF & "Gesucht: " & $hImage1,$mousepos[0],$mousepos[1]) ;~ EndIf ;~ Sleep(50) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_PAINT() _WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_FRAME)); _GDIPlus_GraphicsDrawImageRect($hGraphic,$hImage2,0,0,300,300) _GDIPlus_GraphicsDrawImageRect($hGraphic,$hImage1,10,10,200,200) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_ShutDown() Btw, are you from Frankfurt am Main? Br, UEZ
    1 point
  7. Give me a week or so and then I will divulge. A different approach to getting the first drive letter from the mask. I ported from the example on MSDN. Func _GetDriveFirstFromMask($iMask) Local Const $iShift = 1 Local $iIndex = 0 For $iIndex = 0 To 26 If BitAND($iMask, $iShift) Then ExitLoop EndIf $iMask = BitShift($iMask, $iShift) Next Return $iIndex >= 0 And $iIndex <= 25 ? Chr($iIndex + 65) : Null EndFunc ;==>_GetDriveFirstFromMask
    1 point
  8. LarsJ

    Hide menu bar?

    Removing the main menu from a window and destroying a menu are two different things: _GUICtrlMenu_SetMenu( $hWnd, 0 ) ; Set $hMenu = 0 to remove a menu _GUICtrlMenu_DestroyMenu( $hMenu ) ; Destroy a menu Did you use both commands? For differences in menu styles use _GUICtrlMenu_GetMenuStyle and _GUICtrlMenu_GetMenuInfo to investigate the problem. May be you can do something about it. May be not. One can rarely use that kind of tricks at no cost.
    1 point
  9. Maybe I'm late, but here is my function _WinListExclude. ; #EXAMPLE# ===================================================================================================================== #Include <Array.au3> ; Open 3 notepad Local $aPids[3] = [ Run("notepad.exe"), Run("notepad.exe"), Run("notepad.exe") ] ; Send text in a Notepad window $hNotepad = WinWait("[CLASS:Notepad]") ControlSetText("[CLASS:Notepad]", "", "Edit1", "This is some text") ; List all Notepad windows (based on class) an exclude the text "some" Local $aList = _WinListExclude("[CLASS:Notepad]", "some", 2) _ArrayDisplay($aList) For $i = 0 To Ubound($aPids) - 1 ProcessClose($aPids[$i]) Next ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinListExclude ; Description ...: Retrieves a list of windows, esxcluding windows titles or/and text. ; Syntax ........: _WinListExclude([$sTitle = ""[, $sText = ""[, $iFlag = 0]]]) ; Parameters ....: $sTitle - [optional] The title/hWnd/class of the windows to get or exclude the list. Default is "". ; $sText - [optional] The text of the windows to get or exclude the list. Default is "". ; $iFlag - [optional] Specifies whether to exclude titles, text or both. Default is 0. ; 0 - Do not exlude anything ; 1 - Exclude titles only ; 2 - Exclude text only ; 1 - Exclude both ; Return values .: Returns an array of matching window titles and handles. (See remarks). ; Remarks .......: The array returned is two-dimensional and is made up as follows: ; $aArray[0][0] = Number of windows returned ; $aArray[1][0] = 1st window title ; $aArray[1][1] = 1st window handle (HWND) ; $aArray[2][0] = 2nd window title ; $aArray[2][1] = 2nd window handle (HWND) ; =============================================================================================================================== Func _WinListExclude($sTitle = "", $sText = "", $iFlag = 0) Local $n = 1 Local $iFound If NOT IsNumber($iFlag) Or $iFlag < 0 Or $iFlag > 3 Then Return SetError(1, 0, 0) If NOT $iFlag Then Return WinList($sTitle, $sText) Local $aResult = WinList() Local $aWinFilter = WinList($sTitle) If BitAND($iFlag, 1) Then For $i = 1 To $aResult[0][0] $iFound = 0 For $j = 1 To $aWinFilter[0][0] If $aResult[$i][1] = $aWinFilter[$j][1] Then $iFound = 1 ExitLoop EndIf Next If NOT $iFound Then $aResult[$n][0] = $aResult[$i][0] $aResult[$n][1] = $aResult[$i][1] $n += 1 EndIf Next Redim $aResult[$n][2] $aResult[0][0] = UBound($aResult) - 1 Else $aResult = $aWinFilter EndIf $n = 1 For $i = 1 To $aResult[0][0] $iFound = 0 If BitAND($iFlag, 2) Then If StringInStr( WinGetText($aResult[$i][1]), $sText) Then $iFound = 1 EndIf ElseIf NOT StringInStr( WinGetText($aResult[$i][1]), $sText) Then $iFound = 1 EndIf If NOT $iFound Then $aResult[$n][0] = $aResult[$i][0] $aResult[$n][1] = $aResult[$i][1] $n += 1 EndIf Next Redim $aResult[$n][2] $aResult[0][0] = UBound($aResult) - 1 Return $aResult EndFunc ; ===> _WinListExclude
    1 point
  10. Not really, example: #include <WinAPI.au3> #include <WinAPIex.au3> $iProcesses = 5 Enum $iProcesses_PID, $iProcesses_Hwnd, $iProcesses_UBound Local $aProcesses[$iProcesses][$iProcesses_UBound] For $i = 0 To UBound($aProcesses)-1 $aProcesses[$i][$iProcesses_PID] = Run("notepad") $a = "" While Not IsArray($a) $a = _WinAPI_EnumProcessWindows($aProcesses[$i][$iProcesses_PID],True) WEnd $aProcesses[$i][$iProcesses_Hwnd] = $a[1][0] WinMove($aProcesses[$i][$iProcesses_Hwnd],"",($i*80), ($i*80)) Next For $i = 0 To UBound($aProcesses)-1 ; cascade a bit WinActivate($aProcesses[$i][$iProcesses_Hwnd]) WinWaitActive($aProcesses[$i][$iProcesses_Hwnd]) ControlSend($aProcesses[$i][$iProcesses_Hwnd],"","Edit1", "Testing" & $i) Next ; Activate first window WinActivate($aProcesses[0][$iProcesses_Hwnd]) $sTextToNOTFind = "Testing0" ; this will get the second window $a = WinList("[CLASS:Notepad]") For $i = 1 To UBound($a) - 1 If Not StringInStr(WinGetText($a[$i][1]),$sTextToNOTFind) Then WinActivate($a[$i][1]) WinWaitActive($a[$i][1]) ControlSend($a[$i][1],"","Edit1", @CR & "This is more text on the window WITHOUT text=[" & $sTextToNOTFind & "]") EndIf Next For $i = 0 To UBound($aProcesses)-1 WinActivate($aProcesses[$i][$iProcesses_Hwnd]) Next MsgBox(1,1,"close this to close notepad(s)") For $i = 0 To UBound($aProcesses)-1 ProcessClose($aProcesses[$i][$iProcesses_PID]) Next
    1 point
  11. JohnOne

    Webkit in Autoit

    But feel free to create and share a UDF for it.
    1 point
  12. NoHAX

    ControlSend() MaDnESS

    Hi everyone Again with my program #include-once #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIonEventMode", 1) Opt("MouseCoordMode", 0) Opt("WinTitleMatchMode", 3) Opt("SendAttachMode", 0) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AutoBonner v1.2 by NoHax", 491, 451, 192, 124) GUISetBkColor(0x000000) $Button1 = GUICtrlCreateButton("Run", 304, 344, 161, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Exit", 304, 408, 161, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Options", 304, 376, 161, 25, $WS_GROUP) GUISetState(@SW_SHOW, $Form1) $Form2 = GUICreate("Options", 380, 300, 702, 279) GUISetBkColor(0x000000) $Input1 = GUICtrlCreateInput("", 12, 23, 169, 21) $Input2 = GUICtrlCreateInput("", 12, 71, 169, 21) $Label1 = GUICtrlCreateLabel("Time between bw (more then 24s)", 12, 55, 164, 17) GUICtrlSetColor(-1, 0xFFFFFF) $Button1a = GUICtrlCreateButton("OK", 133, 256, 120, 33, $WS_GROUP) $Label2 = GUICtrlCreateLabel("Text added after bw (optionally)", 12, 200, 152, 17) GUICtrlSetColor(-1, 0xFFFFFF) $Label3 = GUICtrlCreateLabel("Number of bws", 12, 8, 75, 17) GUICtrlSetColor(-1, 0xFFFFFF) $Input3 = GUICtrlCreateInput("", 12, 216, 169, 21) $Label4 = GUICtrlCreateLabel("Diablo II window name", 12, 104, 111, 17) GUICtrlSetColor(-1, 0xFFFFFF) $Input4 = GUICtrlCreateInput("", 12, 120, 169, 21) $Label5 = GUICtrlCreateLabel("Bonewall hotkey", 12, 152, 82, 17) GUICtrlSetColor(-1, 0xFFFFFF) $Input5 = GUICtrlCreateInput("", 12, 168, 169, 21) $Label6 = GUICtrlCreateLabel("Script wrote in AutoIT" & @CRLF & "Author: NoHax" & @CRLF & "Redgrds to all my friends :)", 208, 20, 391, 90) GUICtrlSetColor(-1, 0xFFFFFF) GUISetState(@SW_HIDE, $Form2) GUICtrlSetOnEvent($Button1, "_run") GUICtrlSetOnEvent($Button2, "_exit") GUICtrlSetOnEvent($Button3, "_options") GUICtrlSetOnEvent($Button1a, "_OK") #EndRegion ### END Koda GUI section ### DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _options() GUISetState(@SW_SHOW, $Form2) EndFunc Func _OK() GUISetState(@SW_HIDE, $Form2) Sleep(100) GUISetState(@SW_SHOW, $Form1) EndFunc Func _exit() MsgBox(0, "Cu", "If you found any bugs, pls send me on CRC_3rror@yahoo.com :)") Exit EndFunc Func _run() $title = GUICtrlRead($Input4) $time = GUICtrlRead($Input2) $bwkey = GUICtrlRead($Input5) $text = GUICtrlRead($Input3) $bw = GUICtrlRead($Input1) $hwnd = WinGetHandle($title) GUICtrlSetState($button3, $Gui_disable) For $s=1 To $bw Step 1 Sleep(300) ControlSend($hwnd, '', '',$bwkey) Sleep(300) _MouseClickPlus($hwnd, "right", 536, 233, 1) Sleep(400) ControlSend($Title, '', '', '{Enter}') Sleep(Random(100,200)) ControlSend($Title, '', '',$s+1) Sleep(Random(100,200)) ControlSend($Title, '', '',', ') Sleep(Random(100,200)) ControlSend($Title, "", "",$text) Sleep(Random(100,200)) ControlSend($Title, '', '','{Enter}') Sleep($Time * 1000) Next SoundPlay(@WindowsDir & "\media\tada.wav",1) EndFunc ;=============================================================================== ; ; Function Name: _MouseClickPlus() ; Version added: 0.1 ; Description: Sends a click to window, not entirely accurate, but works ; minimized. ; Parameter(s): $Window = Title of the window to send click to ; $Button = "left" or "right" mouse button ; $X = X coordinate ; $Y = Y coordinate ; $Clicks = Number of clicks to send ; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs. ; Author(s): Insolence <insolence_9@yahoo.com> ; ;=============================================================================== Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1) Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local $MK_RBUTTON = 0x0002 Local $WM_RBUTTONDOWN = 0x0204 Local $WM_RBUTTONUP = 0x0205 Local $WM_MOUSEMOVE = 0x0200 Local $i = 0 Select Case $Button = "left" $Button = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case $Button = "right" $Button = $MK_RBUTTON $ButtonDown = $WM_RBUTTONDOWN $ButtonUp = $WM_RBUTTONUP EndSelect If $X = "" OR $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf For $i = 1 to $Clicks DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $WM_MOUSEMOVE, _ "int", 0, _ "long", _MakeLong($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $ButtonDown, _ "int", $Button, _ "long", _MakeLong($X, $Y)) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle( $Window ), _ "int", $ButtonUp, _ "int", $Button, _ "long", _MakeLong($X, $Y)) Next EndFunc Func _MakeLong($LoWord,$HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc And AutoIT Window Tool show me >>>> Window <<<< Title: Diablo II Class: Diablo II Position: 360, 131 Size: 806, 626 Style: 0x14C00000 ExStyle: 0x00040100 Handle: 0x000E0118 >>>> Control <<<< Class: Instance: ClassnameNN: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: 0x000100B4 >>>> Mouse <<<< Position: 293, 234 Cursor ID: 2 Color: 0x7C7470 >>>> StatusBar <<<< >>>> Visible Text <<<< >>>> Hidden Text <<<< The problem is again with "ControlSend()". Many peoples on this forum have this problem unsolved :\ I used this function few weeks ago and it works fine, but now i try with exactly same method. Need ControlSetText? I working under Vista Homce Basic (added to my laptop). Where is the reason of all this ControlSend problems I cant use ControlID if i dont have controlID ^^ so i left ' "" ' Ahh and second thing Is there any way to remember text what you put to inputs? it is boring to always write informations to Gui. I think about something like cookies for $Input
    1 point
×
×
  • Create New...