Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/16/2014 in all areas

  1. Jon

    AutoIt v3.3.11.3 Beta

    File Name: AutoIt v3.3.11.3 Beta File Submitter: Jon File Submitted: 15 Jan 2014 File Category: Beta 3.3.11.3 (15th January, 2014) (Beta) AutoIt: - Fixed #2613: AutoIt crashes whenever an array value returned from a WMI query is null. - Fixed #2309: Bad conversion of VT_BSTR COM variants when the referenced string is null. UDFs: - Changed: Re-wrote _PathFull() and _PathGetRelative() to use native WinAPI functions. - Changed: Re-wrote _DateDayOfWeek() using new syntax. - Changed: Re-wrote _FileWriteToLine() to use FileReadToArray(). - Changed: Re-wrote _DateDayOfWeek() which can now return the days of the week of the user's locale. - Changed: _FileReadToArray() now returns a 1D/2D array. - Changed: Re-wrote _DateToMonth() which can now return the months of the user's locale. - Added: 5 second timer to _GetIP() between each public IP retrieval. This is to reduce overloading the IP discovery sites. - Added: $STR_REGEXP* contants in StringConstants.au3 for StringRegExp(). - Fixed: _INetSmtpMail() SmtpServer IPaddr checking. - Fixed #2618: _StringBetween() behaviour when $sStart and $sEnd are identical. Click here to download this file
    1 point
  2. SlowCoder74, Try using: GUISetState(@SW_SHOWNOACTIVATE, $hWnd) when you display your GUI - that way the focus is never taken. M23
    1 point
  3. BrewManNH

    GUI CPU USAGE

    BTW, you can remove the GUIGetMsg line from the script, you're not using it anyways so it's just taking up processing time unnecessarily.
    1 point
  4. Zedna

    GUI CPU USAGE

    Also change set of "If" tests IF GUICtrlRead($combo) = "Chiavetta Internet" And _IsPressed("01", "user32.dll") then IF GUICtrlRead($combo) = "Check Yahoo Statuss" And _IsPressed("01", "user32.dll") then ... To Switch command
    1 point
  5. Zedna

    GUI CPU USAGE

    Problem is this line (probably): _GUICtrlIpAddress_Set($hIPAddress, @IPAddress1) You update GUI in each loop no matter if value changes. Use some global variable and compare @IPAddress1 to that value, if it differs then set @IPAddress1 to that variable and update GUI by _GUICtrlIpAddress_Set()
    1 point
  6. Mechaflash

    Greater Than

    EDIT: Checked the WinSetTrans() and it only accepts a range of 0 - 255. Changed the two if statements to reflect this properly. Func _Trans() If IsHWnd($GUI) Then Local $Key = "" MsgBox(0 , "", $Trans) ConsoleWrite(@HotKeyPressed) Switch @HotKeyPressed Case "{PGUP}" If ($Trans + 5) <= 255 Then $Trans += 5 ToolTip($Trans) WinSetTrans($GUI, "", $Trans) EndIf Case "{PGDN}" If ($Trans - 5) >= 0 Then $Trans -= 5 ToolTip($Trans) WinSetTrans($GUI, "", $Trans) EndIf EndSwitch EndIf EndFunc
    1 point
  7. water

    Greater Than

    Why do not write it the other way round? If $Trans > 0 Then $Trans -= 5 ToolTip($Trans) WinSetTrans($GUI, "", $Trans) EndIf If $Trans < 255 Then $Trans += 5 ToolTip($Trans) WinSetTrans($GUI, "", $Trans) EndIf
    1 point
  8. trancexx

    ObjEvent usage.

    Meh, I forgot that you can make event functions execute synchronously. LOL and I wrote the code for that. Yes, you can get id or object that fired the event from within event function: Global $oIE = ObjCreate("InternetExplorer.Application") Local $oEventBrowser = ObjEvent($oIE, "Browser_", "DWebBrowserEvents2") Local $oEventLink1, $oEventButton2 ; to collect event objects to $oIE.navigate("about:blank") ;----------------------------------------------- While Sleep(100) WEnd ; THE END ;----------------------------------------------- Func Customize($oBrowser, ByRef $oEventLink1, ByRef $oEventButton2) Local $sHtml = '<body> <a id="idLink" href="#" title="Link" >Click me</a> <br><br> <button id="idButton" title="Button" >Click me</button> </body>' Local $oDoc = $oBrowser.document $oDoc.write($sHtml) $oBrowser.visible = True Local $oLink1 = $oDoc.getElementById("idLink") Local $oButton2 = $oDoc.getElementById("idButton") ; Event objects $oEventLink1 = ObjEvent($oLink1, "Event_", "HTMLAnchorEvents2") $oEventButton2 = ObjEvent($oButton2, "Event_", "HTMLButtonElementEvents2") EndFunc ;Events for browser Func Browser_OnQuit() Exit EndFunc Func Browser_DocumentComplete($oDisp, $sUrl) Customize($oDisp, $oEventLink1, $oEventButton2) EndFunc ; Events volatile Func Event_onmouseover($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("id = " & $oEvtObj.srcElement.id & " fired onmouseover" & @CRLF) Switch $oEvtObj.srcElement Case $oIE.document.getElementById("idLink") $oEvtObj.srcElement.innerhtml = "Hovering Anchor" Case $oIE.document.getElementById("idButton") $oEvtObj.srcElement.innerhtml = "Hovering Button (click to Exit)" EndSwitch EndIf EndFunc volatile Func Event_onmouseout($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("id = " & $oEvtObj.srcElement.id & " fired onmouseout" & @CRLF) Switch $oEvtObj.srcElement ; check Case $oIE.document.getElementById("idLink") $oEvtObj.srcElement.innerhtml = "Not Hovering Anchor" Case $oIE.document.getElementById("idButton") $oEvtObj.srcElement.innerhtml = "Not Hovering Button (click to Exit)" EndSwitch EndIf EndFunc volatile Func Event_onclick($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("id = " & $oEvtObj.srcElement.id & " fired onclick" & @CRLF) If $oEvtObj.srcElement = $oIE.document.getElementById("idButton") Then $oIE.Quit() Exit EndIf EndIf EndFunc Then It has to be HTMLAnchorEvents2, HTMLButtonElementEvents2, etc... You can compare id-s or objects directly to get the one that fired (i'm checking objects in that example).
    1 point
  9. Zedna

    Where Am i wrong?DllCall

    $fun=_SetUserNamePassword(@AppDataDir& "\Microsoft\Network\Connections\Pbk\rasphone.pbk","HM-LINK","Asd", "HGj") If Not @error Then MsgBox(0,"OK","Done") ElseIf @error Then MsgBox(0,"Error","Error is "&@error) EndIf Func _SetUserNamePassword($lpszPhonebook, $szEntryName, $szUserName, $szPassword, $fRemovePassword = False) Local Const $tagRASDialParams = "struct;dword dwSize;char szEntryName[256];char szPhoneNumber[256];char szCallbackNumber[256];char szUserName[256];char szPassword[256];char szDomain[256];dword dwSubEntry;ulong_ptr dwCallbackId;dword dwIfIndex;endstruct" #cs typedef struct _RASDIALPARAMS { DWORD dwSize; TCHAR szEntryName[RAS_MaxEntryName + 1]; TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1]; TCHAR szCallbackNumber[RAS_MaxCallbackNumber + 1]; TCHAR szUserName[UNLEN + 1]; TCHAR szPassword[PWLEN + 1]; TCHAR szDomain[DNLEN + 1]; DWORD dwSubEntry; ULONG_PTR dwCallbackId; DWORD dwIfIndex; } RASDIALPARAMS, *PRASDIALPARAMS; #ce Local $tInfo = DllStructCreate($tagRASDialParams) DllStructSetData($tInfo, "Size", DllStructGetSize($tInfo)) DllStructSetData($tInfo, "szEntryName", $szEntryName) DllStructSetData($tInfo, "szPhoneNumber", '') DllStructSetData($tInfo, "szCallbackNumber", '') DllStructSetData($tInfo, "szUserName", $szUserName) DllStructSetData($tInfo, "szPassword", $szPassword) DllStructSetData($tInfo, "szDomain", '') DllStructSetData($tInfo, "dwSubEntry", 1) ; ? 0-all DllStructSetData($tInfo, "dwCallbackId", 0) ; ? DllStructSetData($tInfo, "dwIfIndex", 0) ; ? Local $aResult = DllCall("Rasapi32.dll", "dword", "RasSetEntryDialParams", "wstr", $lpszPhonebook, "struct*", $tInfo, "bool", $fRemovePassword) EndFunc
    1 point
  10. trancexx

    ObjEvent usage.

    It's not about whether it's complicated or not, it's about how it should be done. That other thing is how it should be done: Local $sHtml = '<body> <a id="idLink" href="#" title="Link" >Click me</a> <br><br> <button id="idButton" title="Button" >Click me</button> </body>' Local $oIE = ObjCreate("InternetExplorer.Application") $oIE.navigate("about:blank") Sleep(200) ; lame $oIE.document.write($sHtml) $oIE.visible = True Local $oDoc = $oIE.document ConsoleWrite(@error & @CRLF) Local $oLink1 = $oIE.document.getElementById("idLink") Local $oButton2 = $oIE.document.getElementById("idButton") ; Event objects Local $oEventBrowser = ObjEvent($oIE, "Browser_", "DWebBrowserEvents2") Local $oEventLink1 = ObjEvent($oLink1, "Link1_") Local $oEventButton2 = ObjEvent($oButton2, "Button2_") ;----------------------------------------------- While Sleep(100) WEnd ; THE END ;----------------------------------------------- ;Events for browser Func Browser_OnQuit() Exit EndFunc ; Events for link Func Link1_onclick($oEvtObj) $oIE.document.getElementById("idLink").innerhtml = "You clicked me" EndFunc Func Link1_onmouseover($oEvtObj) $oIE.document.getElementById("idLink").innerhtml = "Hovering" EndFunc Func Link1_onmouseout($oEvtObj) $oIE.document.getElementById("idLink").innerhtml = "Not Hovering" EndFunc ; Events for button Func Button2_onmouseover($oEvtObj) $oIE.document.getElementById("idButton").innerhtml = "Hovering Button (click to Exit)" EndFunc Func Button2_onmouseout($oEvtObj) $oIE.document.getElementById("idButton").innerhtml = "Not Hovering Button (click to Exit)" EndFunc Func Button2_onclick($oEvtObj) $oIE.Quit() Exit EndFunc Or even better: Global $oIE = ObjCreate("InternetExplorer.Application") Local $oEventBrowser = ObjEvent($oIE, "Browser_", "DWebBrowserEvents2") Local $oEventLink1, $oEventButton2 ; to collect event objects to $oIE.navigate("about:blank") ;----------------------------------------------- While Sleep(100) WEnd ; THE END ;----------------------------------------------- Func Customize($oBrowser, ByRef $oEventLink1, ByRef $oEventButton2) Local $sHtml = '<body> <a id="idLink" href="#" title="Link" >Click me</a> <br><br> <button id="idButton" title="Button" >Click me</button> </body>' Local $oDoc = $oBrowser.document $oDoc.write($sHtml) $oBrowser.visible = True Local $oLink1 = $oDoc.getElementById("idLink") Local $oButton2 = $oDoc.getElementById("idButton") ; Event objects $oEventLink1 = ObjEvent($oLink1, "Link1_") $oEventButton2 = ObjEvent($oButton2, "Button2_") EndFunc ;Events for browser Func Browser_OnQuit() Exit EndFunc Func Browser_DocumentComplete($oDisp, $sUrl) Customize($oDisp, $oEventLink1, $oEventButton2) EndFunc ; Events for link Func Link1_onclick($oEvtObj) $oIE.document.getElementById("idLink").innerhtml = "You clicked me" EndFunc Func Link1_onmouseover($oEvtObj) $oIE.document.getElementById("idLink").innerhtml = "Hovering" EndFunc Func Link1_onmouseout($oEvtObj) $oIE.document.getElementById("idLink").innerhtml = "Not Hovering" EndFunc ; Events for button Func Button2_onmouseover($oEvtObj) $oIE.document.getElementById("idButton").innerhtml = "Hovering Button (click to Exit)" EndFunc Func Button2_onmouseout($oEvtObj) $oIE.document.getElementById("idButton").innerhtml = "Not Hovering Button (click to Exit)" EndFunc Func Button2_onclick($oEvtObj) $oIE.Quit() Exit EndFunc
    1 point
  11. _WinAPI_GetProcessFileName is in the standard UDFs included with AutoIt. Adam
    1 point
  12. michaelslamet

    Where to begin?

    I know this because I've seen many time Melba's replying this kind of topic (infinite loop that caused by the compiled script name)
    1 point
  13. michaelslamet

    Where to begin?

    Try this: Run("Taskkill /IM explorer.exe /F", @ScriptDir, @SW_HIDE)
    1 point
  14. TechCoder

    Where to begin?

    I believe this is better suited to what you want to do...... https://www.autoitscript.com/autoit3/docs/functions/ProcessClose.htm
    1 point
  15. trancexx

    ObjEvent usage.

    Of course you can attach event handler: #include <IE.au3> Local $oIE = _IECreate("http://google.com") Local $oButton = _IEGetObjById ($oIE, "gbqfba") ; search button (probably) ConsoleWrite(ObjName($oButton) & @CRLF) ConsoleWrite(ObjName($oButton, 4) & @CRLF) ; File with Interface defs ConsoleWrite(ObjName($oButton, 6) & @CRLF) ; CLSID of the object's coclass ; Event object Local $oEvent = ObjEvent($oButton, "_MY_EVENT_HANDLER_") Sleep(10000) _IEQuit($oIE) Func _MY_EVENT_HANDLER_onclick($oEvtObj) ConsoleWrite("!!!!!CLICKED THE BUTTON" & @CRLF) MsgBox(4096, "Yay JohnOne!", "You clicked the button.") EndFunc If you look at that code and see what it prints you will get the name of the object, file with interface definition and CLSID of the object's coclass.Then all you have to do is find script called TLBViewer.au3 in the examples forum and load it with the file that you got (and then save data to some text file) and then find CLSID and look for which event interfaces it implements (it will be something like "// Implemented interface: <IDispatch> HTMLButtonElementEvents" and whatnot. Then find definition of that interface by scrolling up or down an read what events you can catch.
    1 point
  16. JLogan3o13

    Where to begin?

    LMAO Totally missed it, great catch michaelslamet.
    1 point
  17. herosdei, If you are using a version as outdated as 3.2 (the final 3.2.12.1 release was over 5 years ago) then you will not get a lot of sympathy - nor understanding as I doubt anyone here (except perhaps Zedna) runs anything that old. I suggest you update and see if the problem still exists. M23
    1 point
  18. czardas

    MIDI UDF

    I haven't had much time to take a proper look at this until now. I was just running playback tests on all instruments when I discovered the following minor bug at line 234 in Ascendants version of this UDF. The sound does not stop, as it should do. Const $E4_OFF = 0x00000090 ;44 I believe the line of code above should be replaced with the following line: Const $E4_OFF = 0x00004090 ;44 I didn't notice it at first, since with many instruments the volume decays naturally anyway (so it's not noticeable when you listen). It's a very minor thing, but I thought I ought to mention it.
    1 point
  19. spudw2k

    Local admin group members

    I have made such a script. Very useful. Here's a simple function to do so. Requires admin rights (locally and remotely of course).- _GetLocalAdmins() Func _GetLocalAdmins($host = @ComputerName) Dim $filter[1] = ["group"] $colGroups = ObjGet("WinNT://" & $host & "") If Not IsObj($colGroups) Then Return 0 $colGroups.Filter = $filter For $objGroup In $colGroups If $objGroup.name = "Administrators" Then ConsoleWrite($host & @CRLF) For $objUser In $objGroup.Members ConsoleWrite("--" & $objUser.name & @CRLF) Next ConsoleWrite(@CRLF & @CRLF) EndIf Next EndFunc
    1 point
  20. Under the right circumstances, you may find this very useful... Note that this can be used on any webpage, whether you (_IE)Create it or (_IE)Attach to it on the Internet. ; Example demonstrating how to prevent/control refresh, navigation or close of a webpage. ; Particularly useful when you are writing an application with extensive Dynamic HTML ; that can be wiped out with a simple page refresh. #include <IE.au3> $oIE = _IECreate() ; Add HTML to blank page $oBody = _IETagnameGetCollection($oIE, "body", 0) _IEDocInsertHTML($oBody, "<a href=http://www.autoitscript.com>Navigate to http://www.autoitscript.com</a><p>") _IEDocInsertHTML($oBody, "<BUTTON id=b1 value='Normal Exit'>Normal Exit</button>&nbsp;") _IEDocInsertHTML($oBody, "<BUTTON id=b2 value='Safe Exit'> Safe Exit </button>") ; Get references to buttons and setup event handlers $oButton1 = _IEGetObjById($oIE, "b1") $oButton2 = _IEGetObjById($oIE, "b2") $oEvtButton1 = ObjEvent($oButton1, "evtButton_") $oEvtButton2 = ObjEvent($oButton2, "evtButton_") ; Setup random alert string to appear in popup, add a function to be called when onbeforeunload is triggered. ; This is the "magic" in this example $sRandom = "MY-ALERT-" & Random(1000000, 9999999, 1) IEHeadInsertScript($oIE, "function promptBeforeUnload() { return '" & $sRandom & "'; }") IEEval($oIE, "window.onbeforeunload = promptBeforeUnload;") ; With this Javascript injected in the page, any attempt to navigate, refresh or close will ; result in a popup like the following. The key is adding text to the Return statement of the ; function that is bound to the onbeforeunload event. ; ; The TrapAlert routine called in the idle loop watches for the unique string in the alert ($sRandom), ; quickly covers the alert with a splash screen and presses Cancel to abort the action. ; ; This is not a foolproof method if someone is trying to break out because there is often ; enough of a lag for the user to press OK, but in the right circumstances is very effective. ; --------------------------------------------------------------- ; Are you sure you want to navigate away from this page? ; ; MY-ALERT-2522442 ; ; Press OK to continue, or Cancel to stay on the current page. ; ; OK Cancel ; --------------------------------------------------------------- While __IEIsObjType($oIE, "browser") TrapAlert() Sleep(200) WEnd ; --------------- Functions --------------- Func TrapAlert() If WinExists("", $sRandom) Then ControlClick("", $sRandom, "Button2") SplashTextOn("Navigation not allowed!", _ "Use the controls supplied or you will lose all of your work!", -1, -1, -1, -1, 33) Sleep(5000) SplashOff() EndIf EndFunc Func evtButton_onclick() Local $o_object = @COM_EventObj Switch $o_object.value Case "Normal Exit" $oIE.quit Case "Safe Exit" ; Remove the function tied to onbeforeunload and defeat the trap so that ; normal navigation, refresh or close can occur IEEval($oIE, "window.onbeforeunload = '';") $oIE.quit EndSwitch EndFunc Func IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script Return $o_head.appendChild($o_element) EndFunc Dale
    1 point
  21. Sigh, this is why I don't help you people. I end up having to do all the work myself because you can't manage to solve even the most simple of problems. First, Obviously different versions of Windows are using a different class. CabinetWClass is pre-Vista and the other is post-Vista. Or something like that, I don't feel like booting Vista to verify. Second, who gives a fuck, really? Get the right handle to start with and cut out 60% of the code in the process. Func _Update_Explorer() Local $bOld = Opt("WinSearchChildren", True) Local $a = WinList("[CLASS:SHELLDLL_DefView]") For $i = 0 To UBound($a) - 1 DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i][1], "int", 0x111, "int", 28931, "int", 0) Next Opt("WinSearchChildren", $bOld) EndFunc;==>_Update_Explorer
    1 point
×
×
  • Create New...