Jump to content

Search the Community

Showing results for tags 'Event'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • Forum
  • AutoIt


  • Community Calendar

Found 15 results

  1. Good morning guys I was trying to not open another post, writing here my little issue, but seems that no one cares about, and so, I'm opening another post What I'm trying to do, is detect the event close sent from the virtual keyboard. Why? Because, I have an application which, when I set the focus on a textbox, if the virtual keyboard does not exist, then it is created, else, it's not created But, everytime I try to close the virtual keyboard, the focus remains on the textbox, and another $EN_FOCUS event it's launched and detected from my WM_COMMAND, and so, the virtual keyboard is opened again. How can I solve this little "issue"? I was trying to detect the event sent from the virtual keyboard, storing the handle of it in a variable, and setting: GUISetOnEvent($GUI_EVENT_CLOSE, "CloseVK", $hVirtualKeyboard) without any result. Can someone please help me? Thanks EDIT: Here I'd like to see @Melba23, @water, @Danyfirex...
  2. Hello, and thank you for your input. I've been searching around to try to find out how to trigger a change when selecting an option from a dropdown using _IEFormElementOptionSelect, but haven't found anything in the forums or via google. Here is my sample code: ;Select the lead type $LeadType = _IEGetObjByName($oIE, "data[leads_types]") $LeadType.focus _IEFormElementOptionSelect($LeadType, "Expired", 1, "byText") This works to select the value, but it doesn't trigger a date range div that is set with display:none. When done manually there is an event trigger where jquery changes the display setting. The HTML for the dropdown: <select name="data[leads_types]" class="selectbox leadselectbox" style="width:140px;" id="lead_options"> <option value="">Lead Type</option> <optgroup label="Leads"> <option value="1">Divorce</option> <option value="27">Empty Nesters</option> <option value="24">Estate Sales</option> <option value="18">Evictions</option> <option value="2">Expired</option> </optgroup> <optgroup label="CRM"> <option value="11">Cold Lead</option> <option value="20">Dead</option> <option value="13">Follow Up Lead</option> <option value="12">Hot Lead</option> </optgroup> </select>The Html for the div that gets displayed: <div id="date_selection" style="display: none;float: left;margin-left: 5px; width:390px; "> <div style="float: left;font-size:15px"> From: <input class="inputTxt3 dtpicker hasDatepicker" style="width:80px;" size="25" name="offer_from_date" id="offer_from_date" value="08/26/2015" type="text"> To: <input class="inputTxt3 dtpicker hasDatepicker" style="width:80px;" size="25" name="offer_to_date" id="offer_to_date" value="09/10/2015" type="text"> </div> <div style="display: block; float: left;margin-left: 5px;font-size:13px" id="searchTypeDiv"> <span title="Search for Recorded or Filed Dates">Record Date</span> <input type="radio" name="searchDateType" value="r"> <br> <span title="Search for the date RG found the record">Insert Date&nbsp;&nbsp;</span> <input type="radio" name="searchDateType" value="i" checked=""> </div> </div>I've tried changing the values when it isn't displayed, but that doesn't work. I need to find out how to trigger that event. Can someone point me in the right direction? Thanks.
  3. Hi guys, I'm using this startup example to allow the program menu to insert an option to "AutoStart" the script. What I'd like to do is update the checkbox of the menu item after they click it to then reflect the "AutoStart" state (on or off). How do I update the menu on the event someone clicks the menu option? The registry is updating correctly, and if I close and re-run the script the menu is updated, but not in the same script execution. I wasn't sure with TrayItemSetState for my "Func AutoStart()" Function what the "controlID" was. I tried 0 through to 3 and "AutoStart" text. Perhaps this is where I'm going wrong? ; Add custom tray icon menu #NoTrayIcon #include <MsgBoxConstants.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) #include '_Startup.au3' TrayCreateItem("AutoStart") TrayItemSetOnEvent(-1, "AutoStart") If _StartupRegistry_Exists() Then TrayItemSetState(-1, $TRAY_CHECKED) Else TrayItemSetState(-1, $TRAY_UNCHECKED) EndIf TrayCreateItem("About") TrayItemSetOnEvent(-1, "About") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "About") TraySetState($TRAY_ICONSTATE_SHOW) ; ################## ; ### OTHER CODE ### ; ################## Func About() MsgBox(0,"About","etc") EndFunc Func AutoStart() If _StartupRegistry_Exists() Then _StartupRegistry_Uninstall() TrayItemSetState("AutoStart", $TRAY_UNCHECKED) Else _StartupRegistry_Install() TrayItemSetState("AutoStart", $TRAY_CHECKED) EndIf EndFunc Func ExitScript() Exit EndFuncThanks!
  4. My objective was to translate to VBScript into an au3 file so I can code in autoit. I have most of it done however There seems to be certain COM events that autoit does not seem to catch. Mostly the session_SessionStatusChanged and session_SessionStatusLoginError that do not seem to work. When I run it in VBScript it works fine. Any ideas on what I might be doing wrong? I also attached the VBS file I was copying from. ;~ 'SessionStatusCode enum Const $SessionStatusCode_Disconnected = 0 Const $SessionStatusCode_Connecting = 1 Const $SessionStatusCode_TradingSessionRequested = 2 Const $SessionStatusCode_Connected = 3 Const $SessionStatusCode_Disconnecting = 5 Const $SessionStatusCode_SessionLost = 6 Const $SessionStatusCode_PriceSessionReconnecting = 7 Const $SessionStatusCode_Unknown = 8 $username = "" $password = "" If $username = "" Or $password = "" Then MsgBox(16, "Error", "Please provide username and password to the appropriate variables") Exit EndIf $LastStatus = "" $LastError = "" MsgBox(0, "", "Login and logout") $core = ObjCreate("fxcore2.com.Transport") $session = $core.createSession() $Event = ObjEvent($session, "session_") MsgBox(0, "", "Log in...") $session.login($username, $password, "http://www.fxcorporate.com/Hosts.jsp", "Demo") While $LastStatus <> $SessionStatusCode_Connected And $LastError = "" Sleep(50) WEnd MsgBox(0, "", "Log out...") $session.logout While $LastStatus <> $SessionStatusCode_Disconnected Sleep(50) WEnd MsgBox(0, "", "Session status:" & GetStatusName($LastStatus)) $session = "" MsgBox(0, "", "Done !") Func session_SessionStatusChanged($status) MsgBox(0, "", "Status changed: " & GetStatusName($status)) $LastStatus = $status EndFunc ;==>session_SessionStatusChanged Func session_SessionStatusLoginError($err) MsgBox(16, "Error", "Error occured: " & $err) $LastError = "err" EndFunc ;==>session_SessionStatusLoginError Func GetStatusName($status) Switch $status Case $SessionStatusCode_Connected $varGetStatusName = "connected" Case $SessionStatusCode_Disconnected $varGetStatusName = "disconnected" Case $SessionStatusCode_Connecting $varGetStatusName = "connecting" Case $SessionStatusCode_TradingSessionRequested $varGetStatusName = "trading session requested" Case $SessionStatusCode_Disconnecting $varGetStatusName = "disconnecting" Case $SessionStatusCode_SessionLost $varGetStatusName = "session lost" Case $SessionStatusCode_PriceSessionReconnecting $varGetStatusName = "price session reconnecting" Case $SessionStatusCode_Unknown $varGetStatusName = "unknown" Case Else $varGetStatusName = $status EndSwitch Return $varGetStatusName EndFunc ;==>GetStatusName login.vbs
  5. Hi guys/girls! I'm gonna share this UDF I made today. It allows you to easily create TCP servers and set actions depending on three events: OnConnect, OnDisconnect and OnReceive. It is also multi client (you can set the clients limit) and you can also bind a Console-based executable to the socket (similar to -e parameter in NetCat). This feature is useful if you want to use some Console UDF to create your TCP server and don't want to mix it with the TCP functions. Also, as it runs on background just firing events, it won't pause your script while listening/receiving, so you can do anything else (stop and restart the server, allow the user to click buttons or just wait on an infinite loop) that your callbacks will be called once the event is fired. It's also very easy to use. See this examples: Example #1: A basic server By running this (then connecting to the server using Netcat), you will receive a message box telling you when some user connects or disconnects (the socket ID and his IP address is passed as parameter to your callback function) and also when the user sends something over the TCP socket (the data sent is passed as parameter). #cs Download netcat at https://eternallybored.org/misc/netcat/ Execute this script Run in CMD: nc -vv 8081 #ce #include "TCPServer.au3" ; First we set the callback functions for the three events (none of them is mandatory) _TCPServer_OnConnect("connected") _TCPServer_OnDisconnect("disconnect") _TCPServer_OnReceive("received") ; And some parameters _TCPServer_DebugMode(True) _TCPServer_SetMaxClients(10) ; Finally we start the server at port 8081 at any interface _TCPServer_Start(8081) Func connected($iSocket, $sIP) MsgBox(0, "Client connected", "Client " & $sIP & " connected!") _TCPServer_Broadcast('new client connected guys', $iSocket) _TCPServer_Send($iSocket, "Hey! Write something ;)" & @CRLF) _TCPServer_SetParam($iSocket, "will write") EndFunc ;==>connected Func disconnect($iSocket, $sIP) MsgBox(0, "Client disconnected", "Client " & $sIP & " disconnected from socket " & $iSocket) EndFunc ;==>disconnect Func received($iSocket, $sIP, $sData, $sPar) MsgBox(0, "Data received from " & $sIP, $sData & @CRLF & "Parameter: " & $sPar) _TCPServer_Send($iSocket, "You wrote: " & $sData) _TCPServer_SetParam($iSocket, 'will write again') EndFunc ;==>received While 1 Sleep(100) WEnd Example #2: A basic HTTP server (just one page, as it is just an example) In this example, we run this code and point our browser to the address mentioned on the comments. A basic "It works!" page is show. #cs Run this script Point your browser to http://localhost:8081/ #ce #include "TCPServer.au3" _TCPServer_OnReceive("received") _TCPServer_DebugMode(True) _TCPServer_SetMaxClients(10) _TCPServer_Start(8081) Func received($iSocket, $sIP, $sData, $sParam) _TCPServer_Send($iSocket, "HTTP/1.0 200 OK" & @CRLF & _ "Content-Type: text/html" & @CRLF & @CRLF & _ "<h1>It works!</h1>" & @CRLF & _ "<p>This is the default web page for this server.</p>" & @CRLF & _ "<p>However this server is just a 26-lines example.</p>") _TCPServer_Close($iSocket) EndFunc ;==>received While 1 Sleep(100) WEnd Example #3: A telnet-like server (Command Prompt bound to the socket after password requesting) By running this example and connecting with Netcat, we will be asked for a password, which is 12345 as we set on the script. If the password is correct, we will see the Command Prompt live-updated (try running a ping to some server, for example). #cs Download netcat at https://eternallybored.org/misc/netcat/ Execute this script Run in CMD: nc -vv 8081 #ce #include "TCPServer.au3" Global $sPassword = "12345" ; input server password here _TCPServer_OnConnect("connected") _TCPServer_OnDisconnect("disconnect") _TCPServer_OnReceive("received") _TCPServer_DebugMode(True) _TCPServer_SetMaxClients(10) _TCPServer_Start(8081) Func connected($iSocket, $sIP) _TCPServer_Send($iSocket, "Welcome! Please input password: ") _TCPServer_SetParam($iSocket, 'login') EndFunc ;==>connected Func disconnect($iSocket, $sIP) MsgBox(0, "Client disconnected", "Client " & $sIP & " disconnected from socket " & $iSocket) EndFunc ;==>disconnect Func received($iSocket, $sIP, $sData, $sParam) If $sParam = "login" Then If $sData <> $sPassword Then _TCPServer_Send($iSocket, "Wrong password. Try again: ") Return Else _TCPServer_SetParam($iSocket, 'command') _TCPServer_BindAppToSocket($iSocket, 'cmd.exe') EndIf ElseIf $sParam = "command" Then _TCPServer_SendToBound($iSocket, $sData) EndIf EndFunc ;==>received While 1 Sleep(100) WEnd The limit is your imagination? Well, no sure. We have this limit: You can't create more than one server with this UDF in the same script. However, you can pause and resume (read 'stop and start again') your server at any time in your script, without having to reset the server settings. And of course you can have many clients (or just one, it's your choice!) in the same server. Or run multiple instances.Functions list: _TCPServer_Start _TCPServer_Stop _TCPServer_Close _TCPServer_Send _TCPServer_Broadcast _TCPServer_SetParam _TCPServer_BindAppToSocket _TCPServer_SendToBound _TCPServer_UnBindAppToSocket _TCPServer_GetMaxClients _TCPServer_IsServerActive _TCPServer_ListClients _TCPServer_OnConnect _TCPServer_OnDisconnect _TCPServer_OnReceive _TCPServer_SetMaxClients _TCPServer_DebugMode _TCPServer_AutoTrim _TCPServer_SocketToIP _TCPServer_SocketToConnID _TCPServer_ConnIDToSocket Help file and more examples included! Latest version: Download: TCPServer UDF.rar Changelog 1.0 - First release - 18/04/20151.0.0.1 - Bug fix __TCPServer_Accept internal function / help file recompiled - 26/04/2015Perhaps you will need to uncompress the file first, so the help file will work. Fork this on Github: http://github.com/jesobreira/TCPServerUDF TCPServer UDF.rar
  6. Let start with some examples: 1. (As seen in another topic: '?do=embed' frameborder='0' data-embedContent>> ). Script copied from that topic Interrupt function can be any hotkey/event/adlib/callback. If-check inside interrupted function/script ; HotKeySet, or any function that can cause script interrupt HotKeySet("{Delete}", "RemoveSelectedControl") ;... Dim $InfoAboutControls[4096] Global $HandleForCurrentControl ;... While 1 $msg = GuiGetMsg() ;.... ;---Code to process moving a control (drag-n-drop)--- ; If check in MAIN LOOP (interruptible function). If $HandleForCurrentControl > 0 Then;Make sure we have a valid control handle ; ***** oops user pressed Delete key and we get pre-empted ; ***** user removed the selected control. ; ***** Returning from the RemoveSelectedControl function and resuming here: GuiCtrlSetPos($InfoAboutControls[$HandleForCurrentControl], $newLeftPosition, $newTopPosition) EndIf WEnd Func RemoveSelectedControl() $HandleForCurrentControl = -1 EndFunc 2. If-check inside interrupt function Hotkey only. Flag is set right after if check. It's possible or not this function print twice or more? HotKeySet("{Delete}", "_TestHotkey") Func _TestHotkey() Static $bFlag = True If ($bFlag) Then ; ***** Right here, user pressed Delete key ; ***** bFlag is currently not set ; ***** And the script will execute this function twice or more times, instead of just once $bFlag = False ConsoleWrite("This should be printed only ONCE") EndIf EndFunc 3. Same as 2, but with global flag The question is: can I rely on if-checking with a flag, to ensure that my script doesn't do any strange things, as describe in the above examples?
  7. Hi, Here is an UDF to create, delete, set the icon and state, tooltip and tip for your notify icons. The main advantage is that you can handle mouse events as you want, there is no default events. You can create fully customised notifyicons/tooltips. Thanks to Holger Kotsch for his ModernMenu UDF. Note : Breaking changes ! Please use the 1.2+ version. Functions : Attachments : Example + UDF : AutoIt v3.3.10.0+ NotifyIcon_1.2.zip TrayIconEx_1.1.zip AutoIt v3.3.8.0+ TrayIconEx.zip & Requirements : >WinAPIEx UDF. As usual, enjoy !
  8. Hi everyone... i need a little help getting a button click statement to work.. this is what i have.. #include #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("CALs", 494, 408, 425, 188) $serverButton = GUICtrlCreateButton("Server", 112, 72, 105, 41) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $deskButton = GUICtrlCreateButton("Desktop", 256, 72, 105, 41) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $calListBox = GUICtrlCreateList("", 136, 136, 201, 206) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit $sValue = IniRead("C:\IanLogTest\radioButton.ini", "Breed", "Radio Checked", "Error!") Switch $sValue Case "0" if $serverButton Then _GUICtrlListBox_InsertString($calListBox,"test") EndIf Case "1" Run("C:\Program Files\AutoIt3\AutoIt3.exe F:\AutoIt3\testings\auto\dogs.au3") Case "3" Run("C:\Program Files\AutoIt3\AutoIt3.exe F:\AutoIt3\testings\auto\dogs.au3") Case "5" Run("C:\Program Files\AutoIt3\AutoIt3.exe F:\AutoIt3\testings\auto\dogs.au3") EndSwitch EndSwitch WEnd what i want it to do is.. if $serverButton is pressed when $sValue = "0" then display "test" in the $calListBox.... i just dont know how to say IF the button is pressed THEN do THIS - in autoit....
  9. Alright, So I am trying to make an autoit script to create a file and I just looked at the example on the function page for FileWriteLine everything seemed to make since so I added a GUISetOnEvent so that when the "done" button is pressed it will create a file with text in it and it will continue to write the text in it over and over again... I am just trying to get this to work before I do any other stuff. So I used Koda to make the gui real fast (that was the easy part) and I exported it etc and I added the GUISetOnEvent and the function from the FileWriteLine example and it doesn't work. I did get it to work once though but I had to generate the code from Koda with events on everybutton which then left minimize and close useless, so creating a file with text in it worked but closing the application itself didn't which was pretty useless. My question is "How do I make the FileWriteLine actually work?". With this code right now it will not create test.txt with "Line1 Line2 Line3" written in it. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:UsersjustinDesktopcreat-vhostvhost-gui.kxf $Form1 = GUICreate("Create a new vHost for localdev", 401, 201, 325, 193) GUISetBkColor(0xFFFFFF) $website = GUICtrlCreateInput("", 16, 40, 361, 21) GUICtrlSetCursor (-1, 2) $website_label = GUICtrlCreateLabel("Website Name ( Do not provide the extension ex. graphtek.com = graphtek )", 16, 16, 364, 17) $done = GUICtrlCreateButton("Done", 304, 160, 73, 33) GUICtrlSetOnEvent($done, "doneClick") $coldfusion = GUICtrlCreateCheckbox("Is this a coldfusion site?", 16, 72, 281, 20) $directory_edit = GUICtrlCreateButton("Edit Directories", 16, 160, 105, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func doneClick() Local $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, "Line1") FileWriteLine($file, "Line2" & @CRLF) FileWriteLine($file, "Line3") FileClose($file) EndFunc
  10. MouseOnEvent

    Version 1.9


    This UDF allows to set an events handler (a hook) for Mouse device.
  11. I wanted to see if I could manage to use IAppVisibility (Win8) in one of my scripts. (it seems the name was changed in Release Preview but MSDN wasn't updated) It took some time but I learned to make tlb file and made definitions for GetAppVisibilityOnMonitor and IsLauncherVisible methods (working good as far as I can tell), but I would like Advise and Unadvise too if possible, but I don't know how... See definition on above link. Only example I found is some (too advanced for me to translate) c++ code. Here. But it compiles and runs fine at least. trancexx is doing a similar thing in maybe that can be used somehow? Anyone have a clue? Test script with the working funcs: #include <WinAPI.au3> ;=============================================================================== #interface "IAppVisibility" Global Const $sCLSID_AppVisibility = "{7E5FE3D9-985F-4908-91F9-EE19F9FD1514}" Global Const $sIID_IAppVisibility = "{2246EA2D-CAEA-4444-A3C4-6DE827E44313}" ; Definition Global Const $tagIAppVisibility = "GetAppVisibilityOnMonitor hresult(ptr;int*);" & _ "IsLauncherVisible hresult(int*);" & _ "Advise hresult(ptr;dword*);" & _ "Unadvise hresult(dword);" ;============================================================================== Local $oAppVisibility = ObjCreateInterface($sCLSID_AppVisibility, $sIID_IAppVisibility, $tagIAppVisibility) ;~ MsgBox(0, @ScriptName, IsObj($oAppVisibility)) ;~ ConsoleWrite(IsObj($oAppVisibility) & @CRLF) If Not IsObj($oAppVisibility) Then ConsoleWrite("NOT IsObj" & @LF) MsgBox(0, "", "NOT IsObj") Exit EndIf HotKeySet("ö", "_IsLauncherVisible") HotKeySet("å", "_GetAppVisibilityOnMonitor") $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler $callback=DllCallbackRegister("_MonitorEnumProc","int","ptr;ptr;ptr;lparam") Global $Monitor DllCall("user32.dll","int","EnumDisplayMonitors","ptr",0,"ptr",0,"ptr",DllCallbackGetPtr($callback),"lparam",10) While 1 Sleep(1000) WEnd Func _IsLauncherVisible() Local $bVisible $iRet = $oAppVisibility.IsLauncherVisible($bVisible) ;~ If @error Then ;Enable this and disable AutoIt.Error if on Alpha ;~ MsgBox(0, @ScriptName, @error) ;~ EndIf ToolTip("1: " & $iRet & @CRLF & "2: " & $bVisible) EndFunc Func _GetAppVisibilityOnMonitor() Local $iMode $iRet = $oAppVisibility.GetAppVisibilityOnMonitor($Monitor, $iMode) ToolTip("1: " & $iRet & @CRLF & "2: " & $iMode) EndFunc ; This is a custom error handler Func ErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "WinDescription is: " & $oMyError.windescription) $iEventError = 1 ; Use to check when a COM Error occurs EndFunc ;==>ErrFunc Func _MonitorEnumProc($hMonitor, $hdcMonitor, $lprect, $lparam) MsgBox(0, "Monitor", "Monitor handle: " & $hMonitor & @CRLF & "LPARAM: " & $lparam) $Monitor = $hMonitor EndFunc Here's tlb stuff: ================================================================================== coclass AppVisibility; CLSID = {7E5FE3D9-985F-4908-91F9-EE19F9FD1514}; // Implemented interface: <Interface> IAppVisibility ================================================================================== Interface IAppVisibility; IID = {2246EA2D-CAEA-4444-A3C4-6DE827E44313}; // Inherits from: IUnknown {00000000-0000-0000-C000-000000000046} 1. STDCALL FUNC PUREVIRTUAL; HRESULT GetAppVisibilityOnMonitor( [in] hMonitor, [out] int* pMode ); 2. STDCALL FUNC PUREVIRTUAL; HRESULT IsLauncherVisible( [out] int* pfVisible ); 3. STDCALL FUNC PUREVIRTUAL; HRESULT Advise( [in] * pCallback, [out] dword* pdwCookie ); 4. STDCALL FUNC PUREVIRTUAL; HRESULT Unadvise( [in] dword dwCookie ); ================================================================================== enum MONITOR_APP_VISIBILITY; { MAV_UNKNOWN = 0, MAV_NO_APP_VISIBLE = 1, MAV_APP_VISIBLE = 2 }; ================================================================================== Interface IAppVisibilityEvents; IID = {6584CE6B-7D82-49C2-89C9-C6BC02BA8C38}; // Inherits from: IUnknown {00000000-0000-0000-C000-000000000046} 1. STDCALL FUNC PUREVIRTUAL; HRESULT AppVisibilityOnMonitorChanged( [in] hMonitor, [in] previousMode, [in] currentMode ); 2. STDCALL FUNC PUREVIRTUAL; HRESULT LauncherVisibilityChange( [in] int currentVisibleState ); ==================================================================================
  12. I've been working on a fancy ListView for user input. When a cell is clicked, a temporary Combo or Input control is created. The user does their part, then the temporary control's data is transferred to the ListView and the temporary control is deleted. I'm quite pleased with how it's turned out, except for one puzzling "feature". If I use "Switch GUIGetMsg()" in the main loop, then the first time a user clicks on the form causes a temp control to be both created and processed. That only occurs on the first click and not on any subsequent clicks. If I use "$msg = GUIGetMsg(1)" with a Switch command, it works properly on every click. See code below. I have no idea why this is. Does anyone else? I'll use GUIGetMsg(1) if I must, but I prefer my code to be as simple as possible. #include #include #include #include #include Global Const $_INCL = 1, $_REGEX = 2, $_FILTER = 3 Global $h_TempCtrl, $TempCtrlStatus[3] = [False, -1, -1], $_ListViewY = 1 Switch @OSVersion Case "WIN_2000", "WIN_XP", "WIN_XPe", "WIN_2003" $_ListViewY = 0 EndSwitch $h_GUI = GUICreate("Form1", 594, 329) $h_ListView = GUICtrlCreateListView("#|Include or Not|Filter Type|Contents ", 24, 24, 545, 279, $LVS_SINGLESEL) $hG_LVitem1 = GUICtrlCreateListViewItem("1.|Include|StringRegExp|", $h_ListView) $hG_LVitem2 = GUICtrlCreateListViewItem("2.|Include|StringRegExp|", $h_ListView) $hG_LVitem3 = GUICtrlCreateListViewItem("3.|Include|StringRegExp|", $h_ListView) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() ;~ $msg = GUIGetMsg(1) ;~ Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $h_TempCtrl If $h_TempCtrl <> 0 Then _GUICtrlTemp_Apply("$h_TempCtrl") EndIf EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Catch ListView messages Local $hWndFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") If $hWndFrom == GUICtrlGetHandle($h_ListView) And $iCode == $NM_CLICK Then _GUICtrlTemp_Create() Return $GUI_RUNDEFMSG EndFunc Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg ; Catch user input Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) If $TempCtrlStatus[0] Then If $hWndFrom == GUICtrlGetHandle($h_TempCtrl) Then Switch $iCode Case $CBN_SELENDOK _GUICtrlTemp_Apply("$CBN_SELENDOK") Case $CBN_SELENDCANCEL _GUICtrlTemp_Delete("$CBN_SELENDCANCEL") Case $EN_KILLFOCUS _GUICtrlTemp_Apply("$EN_KILLFOCUS") EndSwitch EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func _GUICtrlTemp_Create() ; Create a temporary control for user input Local $tempPos, $HitTest $HitTest = _GUICtrlListView_SubItemHitTest(GUICtrlGetHandle($h_ListView)) If $HitTest[0] <> -1 Then $TempCtrlStatus[0] = True $TempCtrlStatus[1] = $HitTest[0] $TempCtrlStatus[2] = $HitTest[1] Switch $HitTest[1] ; Global Const $_INCL = 1, $_REGEX = 2, $_FILTER = 3, $_FREQ = 4 Case $_INCL $tempPos = _GUICtrlListView_GetSubItemRect($h_ListView, $HitTest[0], $_INCL) $h_TempCtrl = GUICtrlCreateCombo("", $tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2] - $tempPos[0], $tempPos[3] - $tempPos[1], $CBS_DROPDOWNLIST) GUICtrlSetData($h_TempCtrl, "Include|Don't Include") GUICtrlSetState($h_TempCtrl, BitOR($GUI_FOCUS, $GUI_ONTOP)) _GUICtrlComboBox_ShowDropDown($h_TempCtrl, True) Case $_REGEX $tempPos = _GUICtrlListView_GetSubItemRect($h_ListView, $HitTest[0], $_REGEX) $h_TempCtrl = GUICtrlCreateCombo("", $tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2] - $tempPos[0], $tempPos[3] - $tempPos[1], $CBS_DROPDOWNLIST) GUICtrlSetData($h_TempCtrl, "String|StringRegExp") GUICtrlSetState($h_TempCtrl, BitOR($GUI_FOCUS, $GUI_ONTOP)) _GUICtrlComboBox_ShowDropDown($h_TempCtrl, True) Case $_FILTER $tempPos = _GUICtrlListView_GetSubItemRect($h_ListView, $HitTest[0], $_FILTER) Local $hRegion = _WinAPI_CreateRectRgn($tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2], $tempPos[3]) $h_TempCtrl = GUICtrlCreateInput(_GUICtrlListView_GetItemText($h_ListView, $HitTest[0], 3), $tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2] - $tempPos[0], $tempPos[3] - $tempPos[1]) GUICtrlSetState($h_TempCtrl, BitOR($GUI_FOCUS, $GUI_ONTOP, $GUI_SHOW)) _GUICtrlEdit_SetSel($h_TempCtrl, 0, -1) _WinAPI_RedrawWindow($h_GUI, 0, $hRegion, $RDW_UPDATENOW) ; It won't draw the control until mouse-out *** (WHY??) EndSwitch EndIf EndFunc Func _GUICtrlTemp_Apply( $caller ) ; Apply the temporary control's text to the ListView If $TempCtrlStatus[0] Then $TempCtrlStatus[0] = False _GUICtrlListView_SetItemText($h_ListView, $TempCtrlStatus[1], GUICtrlRead($h_TempCtrl), $TempCtrlStatus[2]) $TempCtrlStatus[1] = -1 $TempCtrlStatus[2] = -1 _GUICtrlTemp_Delete($caller & " -> Apply") EndIf EndFunc Func _GUICtrlTemp_Delete( $caller ) ConsoleWrite("Delete called by: " & $caller & @LF & "$h_TempCtrl: " & $h_TempCtrl & @LF & @SEC & ':' & @MSEC & @LF & @LF) ; Get rid of the temporary control GUICtrlDelete($h_TempCtrl) EndFunc
  13. Hey everybody. I have been using GUIOnEventMode for a while now, and have never come across this problem. When I am running my script, if I click a button with an event assigned to it, then it seems to queue the events until I right click on the autoit tray icon and tell it to exit, and then it runs the appropriate events for the functions, and then continues to run the script until it reaches the next GUI, and then the same happens. This is the script (Ofcourse I have removed the company name from it though). I am using on Windows 7 Home Premium 64 bit, running the 32 bit AutoIT Executable. #AutoIt3Wrapper_UseX64=N #include <Array.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <Misc.au3> #include <String.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnEsc", 0) Opt("TrayAutoPause", 0) _GDIPlus_Startup() OnAutoItExitRegister('_OnExit') Global $TestGui = 0, $DataGuiArray[10], $ProdNumGuiArray[6], $GUIArray[19], $Selected, $FilePath, $File, $Product, $PInfo, $PWarranty, $PDetails, $PCode, $PWrap, $PMain, $PName, $PCost, $PImages, $ImagesString, $Repeat, $PDetails, $PBrand, $PDelivery, $PWholeSale, $PSearchTags, $PWholesale, $SEOKeywords, $SEODesc, $PNum = "NO PRODUCT NUMBER", $PNumLimit, $MichaelBot = "MichaelBot/1.0 (+http://http://www.Michaelonline.com.au/)", $ThisImage = 0, $Pic, $ImagesGuiArray[5], $ImagesDirectory = "C:\Users\"&@UserName&"\Desktop\Images", $PImagesArray Global $UsePNum = 0, $Mode = 0 HttpSetUserAgent($MichaelBot) If $TestGui = 1 Then _CreateGUI() EndIf If $UsePNum = 1 Then _ProdNum() EndIf _Start() Func _ProdNum() $ProdNumGuiArray[0] = GUICreate("Automatic Product Numbers", 120, 120) $ProdNumGuiArray[1] = GUICtrlCreateLabel("From", 20, 20, 30, 21) $ProdNumGuiArray[2] = GUICtrlCreateInput("", 50, 17, 50, 21) $ProdNumGuiArray[3] = GUICtrlCreateLabel("To", 20, 50, 21) $ProdNumGuiArray[4] = GUICtrlCreateInput("", 50, 47, 50, 21) $ProdNumGuiArray[5] = GUICtrlCreateButton("OK", 40, 80, 40, 30) GUICtrlSetOnEvent($ProdNumGuiArray[5], "_CheckProdNum") GUISetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $ProdNumGuiArray[0]) Local $Msg = 0 While 1 WEnd EndFunc Func _CheckProdNum() GUISetState(@SW_HIDE, $ProdNumGuiArray[0]) If GUICtrlRead($ProdNumGuiArray[2]) = "" Or GUICtrlRead($ProdNumGuiArray[4]) = "" Then MsgBox(0,"","Please insert a number in both input boxes.") Else If Number(GUICtrlRead($ProdNumGuiArray[2])) > Number(GUICtrlRead($ProdNumGuiArray[4])) Then MsgBox(0,"","The first number should be smaller than the second.") Else $PNum = Number(GUICtrlRead($ProdNumGuiArray[2])) $PNum -= 1 $PNumLimit = Number(GUICtrlRead($ProdNumGuiArray[4])) GUIDelete($ProdNumGuiArray[0]) _Start() EndIf EndIf EndFunc Func _Start() If $UsePNum = 1 Then If $PNum <> "NO PRODUCT NUMBER" Then If $PNum > $PNumLimit Then _ProdNum() Else $PNum += 1 EndIf EndIf EndIf Local $URL = 'http://www.oo.com.au/Vivitar-iTwist-X018-Digital-Ca_P42902C901.cfm';InputBox("URL", "Please input the product's URL.", ClipGet()) If $URL = "" Then MsgBox(0,"","No URL Supplied.") _Start() EndIf If Not _IsURL($URL) Then MsgBox(0,"","Given string is not URL.") _Start() EndIf If StringInStr($URL, "?") Then $URL = StringLeft($URL, StringInStr($URL, "?")) EndIf If Not StringInStr($URL, "http://") Then $URL = 'http://'&$URL EndIf Local $FilePath = @ScriptDir&"\File\File.html" ;~ ABOVE IS VALIDATION FOR THE URL ClipPut("") ;~ DOWNLOADING THE WEBPAGE InetGet($URL, $FilePath, 16, 0) If FileExists(@ScriptDir&"\File\File.htm") Then FileMove(@ScriptDir&"\File\File.htm", $FilePath, 9) EndIf ;~ ENSURING THAT THE CORRECT FILE EXISTS $File=FileRead($FilePath) ;~ GETTING THE FILE CONTENTS If $File = '' Then ;~ IF FILE NOT DOWNLOADED FROM OO ATTEMPT DOWNLOAD FROM GOOGLE CACHE MsgBox(0,"Error","Could Not Download from OO.com.au"&@CRLF&"Now attempting download from Google Cache.") If StringInStr($URL, 'http://') Then ;~ REMOVE HTTP FROM URL $URL = StringTrimLeft($URL, 7) EndIf $URL = StringTrimRight($URL, 9)&".cfm" ;~ REMOVE ARGUMENTS AND PARAMETERS FROM URL HttpSetUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1') ;~ SET USER AGENT TO FIREFOX TO AVOID GOOGLE CACHE ERRORS InetGet('http://webcache.googleusercontent.com/search?q=cache:'&$URL, $FilePath, 16, 0) ;~ ATTEMPT TO DOWNLOAD FILE FROM GOOGLE CACHE If FileExists(@ScriptDir&"\File\File.htm") Then FileMove(@ScriptDir&"\File\File.htm", $FilePath, 9) EndIf ;~ ENSURING THAT THE CORRECT FILE EXISTS HttpSetUserAgent($MichaelBot) ;~ RESETTING THE USER AGENT TO MichaelBOT $File=FileRead($FilePath) ;~ GETTING THE FILE CONTENTS If $File = '' Then ;~ IF FILE NOT DOWNLOADED FROM GOOGLE CACHE THEN DOWNLOAD MANUALLY MsgBox(0,"Error","Could Not Download from Google Cache"&@CRLF&"Please save the file manually to "&$FilePath&".") While Not FileExists($FilePath) If FileExists(@ScriptDir&"\File\File.htm") Then FileMove(@ScriptDir&"\File\File.htm", $FilePath, 9) EndIf ;~ ENSURING THAT THE CORRECT FILE EXISTS Sleep(1000) WEnd ;~ WAITING FOR USER TO DOWNLOAD FILE MsgBox(0,"","File detected. Attempting to use file as source.") $File=FileRead($FilePath) ;~ GETTING THE FILE CONTENTS If StringInStr(StringStripWS($File, 8), "Ashardaswetrywestillaren'tperfect.Wesuggestthatyoutryagainorcontactus.We'resorryforanyinconveniencethismaycause.We'lltryourbesttomakesureitdoesnothappenagain.") Then MsgBox(0,"ERROR","It appears that OO.com.au is down!"&@CRLF&"Attempting alternate download methods.") EndIf If $File = '' Or StringInStr(StringStripWS($File, 8), "Ashardaswetrywestillaren'tperfect.Wesuggestthatyoutryagainorcontactus.We'resorryforanyinconveniencethismaycause.We'lltryourbesttomakesureitdoesnothappenagain.") Then ;~ IF OO IS OFFLINE OR IF USER COULD NOT DOWNLOAD FROM OO $Msgbox = MsgBox(4,"Error", "Program could not read contents of file."&@CRLF&"Would you like to attempt to manually load the file's HTML into the program?") ;~ PRESENT USER WITH THE OPTION TO PASTE THE HTML INTO THE PROGRAM If $Msgbox = 6 Then ;~ IF USER ACCEPTS $File = InputBox("Insert HTML", "Please insert the page's source.", "") ;~ PRESENT USER WITH AN INPUT BOX TO PASTE THE HTML If $File = '' Then ;~ IF THE USER PASTED NOTHING MsgBox(0,"","Failed to retrieve page source from input box."&@CRLF&"Now Exiting.") Exit ;~ GIVE UP ON THE USER. MIGHT BE A GOOD IDEA TO BE PERSISTENT AND PLACE IN WHILE LOOP----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- EndIf Else ;~ IF USER DECLINES MsgBox(0,"","As the program could not retrieve the requested data, it will not exit.") Exit ;~ EXIT EndIf EndIf EndIf EndIf If StringInStr($File, 'images/refurbished.gif') Then ;~ ENSURE THAT THE PRODUCT IS NOT REFURBISHED MsgBox(0,"REFURBISHED", "Error - This product has been refurbished!");http://www.oo.com.au/Kodak-M531-Digital-Camera-14_P89056C901.cfm ;~ FileDelete($File) _Start() ;~ IF THE PRODUCT IS REFURBISHED, THEN MOVE USER ON TO NEXT PRODUCT EndIf ;~ MsgBox(0,"",$File) ;~ FileDelete($FilePath) _GetData() EndFunc Func _GetData() $ThisImage = 0 $Pic = 0 $Product = _HTMLGetElementByID($File, 'product') $PInfo = _HTMLGetElementByID($Product, 'p_info') $PWarranty = _HTMLGetElementByID($PInfo, 'p_warranty') $PWarranty = _HTMLGetWarranty($PWarranty) $PDetails = _HTMLGetElementByID($PInfo, 'p_details') $PBrand = _HTMLGetBrand($PDetails) If $PBrand = '' Then $PBrand = 'Michael' $PCode = _HTMLGetProductCode($PDetails) $PWrap = _HTMLGetElementByID($Product, 'p_wrap') $PMain = _HTMLGetElementByID($PWrap, 'p_main') $PName = StringTrimLeft(StringTrimRight($PMain, StringLen($PMain) - StringInStr($PMain, '</h1>')+1), StringInStr($PMain, '<h1>')+3) $PCost = _HTMLGetCost($PMain) $PWholeSale = $PCost $PCost = _Price($PCost) $PDelivery = _Delivery($PMain) $PImages = _HTMLGetElementByID($PWrap, 'p_imgs') $PImages = _HTMLGetImages($PImages) $PImagesArray = StringSplit($PImages, "|", 3) ;~ MsgBox(0,"",$PCode) For $Repeat = 0 To UBound($PImagesArray)-1 $PImagesArray[$Repeat] = 'http://img.oo.com.au/prod/'&$PCode&'/'&$Repeat+1&'b.jpg' Next $PDetails = _HTMLGetDescription($PDetails, $PWarranty) $PSearchTags = _GetSearchTags($PName) $SEOKeywords = _GetSEOKeywords($PName) $SEODesc = _GetSEODescription($PDetails) _Images() EndFunc Func _CreateGUI() ;GUI WINDOW $GUIArray[0] = GUICreate(" ", 170, 580, @DesktopWidth-200, 75) WinSetOnTop($GuiArray[0], "", 1) ;BASIC DETAILS $GUIArray[1] = GUICtrlCreateRadio("Product Name", 22, 25) $GUIArray[2] = GUICtrlCreateRadio("Product Code", 22, 45) ;PRICE DETAILS $GUIArray[3] = GUICtrlCreateRadio("Final Price", 22, 90) ;DESCRIPTION $GUIArray[4] = GUICtrlCreateRadio("Description", 22, 135) ;IMAGES $GUIArray[5] = GUICtrlCreateRadio("Images", 22, 180) ;Copies the image URL into an array ;ADVANCED DETAILS $GUIArray[6] = GUICtrlCreateRadio("Wholesale Price", 22, 225) $GUIArray[7] = GUICtrlCreateRadio("Brand", 22, 245) $GUIArray[8] = GUICtrlCreateRadio("Notes", 22, 265) $GUIArray[9] = GUICtrlCreateRadio("Product Search Tags", 22, 285) $GuiArray[10] = GUICtrlCreateRadio("Product Identifiers", 22, 305) ;POSTAGE $GUIArray[11] = GUICtrlCreateRadio("Fixed Cost", 22, 350) ;SEARCH ENGINE OPTIMISATION $GUIArray[12] = GUICtrlCreateRadio("Title", 22, 395) $GUIArray[13] = GUICtrlCreateRadio("Keywords", 22, 415) $GUIArray[14] = GUICtrlCreateRadio("Description", 22, 435) $GUIArray[15] = GUICtrlCreateRadio("Custom URL", 22, 455) ;BUTTONS $GUIArray[16] = GUICtrlCreateButton("View Data", 10, 490, 150, 22) GUICtrlSetOnEvent($GuiArray[16], "_DataGUI") $GuiArray[17] = GUICtrlCreateButton("New Product", 10, 520, 150, 22) GUICtrlSetOnEvent($GuiArray[17], '_ReStart') ;STATUSBAR $GuiArray[18] = _GUICtrlStatusBar_Create($GuiArray[0]) _GUICtrlStatusBar_SetText($GuiArray[18], $PNum) ;GROUPS GUICtrlCreateGroup("Basic Details", 10, 10, 150, 60) GUICtrlCreateGroup("Price Details", 10, 75, 150, 40) GUICtrlCreateGroup("Description", 10, 120, 150, 40) GUICtrlCreateGroup("Images", 10, 165, 150, 40) GUICtrlCreateGroup("Advanced Details", 10, 210, 150, 120) GUICtrlCreateGroup("Postage", 10, 335, 150, 40) GUICtrlCreateGroup("Search Engine Optimisation", 10, 380, 150, 100) ;GUI BEHAVIORS GUICtrlSetState($GUIArray[1], 1) GUISetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $GuiArray[0]) ;CONTINUING WITH THE SCRIPT If $TestGui = 0 Then _Main() EndIf While 1 WEnd EndFunc Func _Main() WinsetOnTop(" ", "", 1) If $PBrand = '' Then GUICtrlSetState($GuiArray[7], $GUI_DISABLE) EndIf While 1 For $Repeat = 1 To 16 ;Getting selected radio box If GUICtrlRead($GuiArray[$Repeat]) = 1 Then ; MsgBox(0,"",$Selected) $Selected = $Repeat ExitLoop EndIf Next Switch $Selected Case 1 ;Product Name ClipPut($PName) While GUICtrlRead($GuiArray[1]) = 1 ;~ If _IsPressed(11) And _IsPressed(56) Then ;~ GUICtrlSetState($GuiArray[3], $GUI_CHECKED) ;~ EndIf WEnd Case 2 ;Product Code ClipPut($PNum) While GUICtrlRead($GuiArray[2]) = 1 If _IsPressed(11) And _IsPressed(56) Then While _IsPressed(11) And _IsPressed(56) WEnd Sleep(100) Send("{TAB}") Send("10") EndIf WEnd Case 3 ;Product Cost ClipPut($PCost) While GUICtrlRead($GuiArray[3]) = 1 WEnd Case 4 ;Product Description ClipPut($PDetails) While GUICtrlRead($GuiArray[4]) = 1 WEnd Case 5 ;Images ClipPut($PImagesArray[0]) $ThisImage = 0 While GUICtrlRead($GuiArray[5]) = 1 If _IsPressed(11) And _IsPressed(56) Then $ThisImage += 1 If $ThisImage = UBound($PImagesArray) Then ClipPut("") Else ClipPut($PImagesArray[$ThisImage]) EndIf EndIf WEnd Case 6 ;Wholesale ClipPut($PWholeSale) While GUICtrlRead($GuiArray[6]) = 1 WEnd Case 7 ;Brand ClipPut($PBrand) While GUICtrlRead($GuiArray[7]) = 1 WEnd Case 8 ;Notes ClipPut('Product Code: '&$PCode) While GUICtrlRead($GuiArray[8]) = 1 WEnd Case 9 ;Product Search Tags ClipPut(StringLeft($PSearchTags, StringInStr($PSearchTags, "|", 0, 1)-1)) $ThisPSearchTags = $PSearchTags While GUICtrlRead($GuiArray[9]) = 1 If _IsPressed(11) And _IsPressed(56) Then Sleep(100) $ThisPSearchTags = StringTrimLeft($ThisPSearchTags, StringInStr($ThisPSearchTags, "|")) ClipPut(StringLeft($ThisPSearchTags, StringInStr($ThisPSearchTags, "|")-1)) While _IsPressed(11) And _IsPressed(56) WEnd EndIf If ClipGet() = '' Then While GUICtrlRead($GuiArray[9]) = 1 WEnd EndIf WEnd Case 10 ;Product Identifyer ClipPut($PCode) While GUICtrlRead($GuiArray[10]) = 1 WEnd Case 11 ;Fixed Cost Postage ClipPut($PDelivery) While GUICtrlRead($GuiArray[10]) = 1 WEnd Case 12 ;SEO Title ClipPut($PName) While GUICtrlRead($GuiArray[11]) = 1 WEnd Case 13 ;SEO Keywords ClipPut($SEOKeywords) While GUICtrlRead($GuiArray[12]) = 1 WEnd Case 14 ;SEO Description ClipPut($SEODesc) While GUICtrlRead($GuiArray[13]) = 1 WEnd Case 15 ;Custom URL ClipPut($PNum) While GUICtrlRead($GuiArray[14]) = 1 WEnd EndSwitch WEnd EndFunc Func _DataGUI() $DataGuiArray[0] = GUICreate("", @DesktopWidth*0.75, @DesktopHeight*0.75, 0, 0, 0x010F0000) $DataGuiArray[1] = GUICtrlCreateListView("Name|Data", 0, 0, @DesktopWidth, @DesktopHeight) GUICtrlSetResizing($GuiArray[1], '102') $DataGuiArray[2] = GUICtrlCreateListViewItem("Product Name|"&$PName, $GuiArray[1]) $DataGuiArray[3] = GUICtrlCreateListViewItem("Product Cost|"&$PCost, $GuiArray[1]) $DataGuiArray[4] = GUICtrlCreateListViewItem("Delivery Cost|"&$PDelivery, $GuiArray[1]) $DataGuiArray[5] = GUICtrlCreateListViewItem("Description|"&$PDetails, $GuiArray[1]) $DataGuiArray[6] = GUICtrlCreateListViewItem("Wholesale|"&$PWholeSale, $GuiArray[1]) If $PBrand = "" Then $DataGuiArray[7] = GUICtrlCreateListViewItem("Brand|BRAND UNKNOWN", $GuiArray[1]) GUICtrlSetBkColor($DataGuiArray[7], 0xff5040) Else $DataGuiArray[7] = GUICtrlCreateListViewItem("Brand|"&$PBrand, $DataGuiArray[1]) EndIf $DataGuiArray[8] = GUICtrlCreateListViewItem("Warranty|"&$PWarranty, $DataGuiArray[1]) GuiSetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $DataGuiArray[0]) Return EndFunc Func _HTMLGetElementByID($html_code, $div_id) Local $o_htmlfile = ObjCreate('HTMLFILE') If Not IsObj($o_htmlfile) Then Return SetError(-1, 0, '') EndIf $o_htmlfile.open() $o_htmlfile.write($html_code) $o_htmlfile.close() Local $div = $o_htmlfile.getElementByID($div_id) If Not IsObj($div) Then Return SetError(0, 0, '') EndIf Return $div.outerHTML EndFunc Func _HTMLGetDescription($Desc, $Warranty) $Desc = StringStripWS($Desc, 3) $Desc = StringReplace($Desc, "<p>", "") $Desc = StringReplace($Desc, "</p>", "<br />") $Title = StringTrimLeft($Desc, StringInStr($Desc, '<h2>')+3) $Title = StringTrimRight($Title, StringLen($Title) - StringInStr($Title, '</h2>')+1) $Title = '<div style="text-align: center;"><strong><span style="font-size: 20px; font-family: arial; color: #3333ff;">'&$Title&'</span></strong></div>' ;~ MsgBox(0, "Title", $Title) $Desc = StringTrimRight($Desc, (StringLen($Desc) - StringInStr($Desc, "<h4"))+1) $Desc = '<span style="font-size: 12px; font-family: arial;"><br />'&StringTrimLeft($Desc, StringInStr($Desc, "<DIV class=clear></DIV>")+24) $DescBody = StringLeft($Desc, StringInStr($Desc, '<h3>')-1) ;~ MsgBox(0, "DescBody", $DescBody) $Desc = StringTrimLeft($Desc, StringInStr($Desc, '<h3>')-1) $Desc = StringReplace($Desc, "<h3>", "<strong>") $Desc = StringReplace($Desc, "</h3>", "</strong>") $Desc = StringReplace($Desc, '<strong>Product Features</strong>', '<strong>Product Features</strong>') $Desc = StringReplace($Desc, '<strong>Features</strong>', '<strong>Product Features</strong>') $Desc = StringReplace($Desc, "<strong>Specifications</strong>", "<strong>Product Specifications</strong>") $Desc = StringReplace($Desc, "<strong>Contents</strong>", "<strong>Package Contents</strong>") $Desc = StringReplace($Desc, "<strong>Package Contains</strong>", "<strong>Package Contents</strong>") $Desc = StringReplace($Desc, "<strong>Contains</strong>", "<strong>Package Contents</strong>") If $Warranty = "This product comes with a warranty covered by either oo.com.au or the supplier of this product." Then $Desc &= "This product comes with a warranty.</span>" Else $Desc &= $Warranty&"</span>" EndIf $Desc = StringReplace($Desc, '</li></ul>', '</li>'&@CRLF&'</ul>') $DescBody = StringStripWS($DescBody, 7) While StringRight($DescBody, 6) = '<br />' $DescBody = StringTrimRight($DescBody, 6) $DescBody = StringStripWS($DescBody, 7) WEnd While StringRight($DescBody, 6) = '<br /><br />' $DescBody = StringReplace($DescBody, '<br /><br />', '<br />') $DescBody = StringStripWS($DescBody, 7) WEnd $DescBody = StringReplace($DescBody, '<br />', '<br /><br />'&@CRLF) $DescArray = StringSplit($Desc, @CR&@LF&@CRLF, 2) ;~ _ArrayDisplay($DescArray) $Desc = "" For $Repeat = 0 To UBound($DescArray)-1 $DescArray[$Repeat] = StringStripWS($DescArray[$Repeat], 3) If StringLeft($DescArray[$Repeat], 5) = ' <li>' And StringRight($DescArray[$Repeat], 5) <> '</li>' Then $DescArray[$Repeat] = ' '&$DescArray[$Repeat]&'</li>' EndIf If $DescArray[$Repeat] <> "" Then $Desc &= $DescArray[$Repeat]&@CRLF EndIf Next ;~ MsgBox(0, "DotPoints", $Desc) $Title = StringStripWS($Title, 3) $DescBody = StringStripWS($DescBody, 3)&'<br /><br />' $Desc = StringStripWS($Desc, 3) $Desc = StringReplace($Desc, '<li>', ' <li>') $Desc = StringReplace($Desc, '</li>', '</li>') $Desc = StringReplace($Desc, '<strong>', '<strong>') $Desc = StringReplace($Desc, '</strong>', '</strong>') $Desc = StringReplace($Desc, '<ul>', '<ul>') $Desc = StringReplace($Desc, '</ul>', '</ul>') Return $Title&@CRLF&$DescBody&@CRLF&$Desc EndFunc Func _HTMLGetProductCode($Desc) $Code = StringTrimRight($Desc, StringLen($Desc)-StringInStr($Desc, '</h4>')+1) $Code = StringRight($Code, StringLen($Code) - StringInStr($Code, 'Product Code:')-13) Return $Code EndFunc Func _HTMLGetImages($Images) $Images = StringTrimLeft($Images, StringInStr($Images, 'http')-1) Local $ImagesString = StringLeft($Images, StringInStr($Images, '.jpg')+3)&'|' While StringLeft($Images, StringInStr($Images, '.jpg')+3) <> StringRight($ImagesString, StringLen($ImagesString) - StringInStr($ImagesString, '|', 0, 1))&'|' If StringInStr($Images, 'http', 0, 2)-1 = '-1' Then ExitLoop EndIf $Images = StringTrimLeft($Images, StringInStr($Images, 'http', 0, 2)-1) $ImagesString &= StringLeft($Images, StringInStr($Images, '.jpg')+3)&'|' WEnd $ImagesString = StringTrimRight($ImagesString, 1) ;~ MsgBox(0,"", $Images) ;~ MsgBox(0,"Images",$ImagesString) Return $ImagesString EndFunc Func _HTMLGetBrand($Desc) Local $Brand = "" If StringInStr($Desc, '<div class="brand">') Then $Brand = StringTrimRight(StringTrimLeft($Desc, StringInStr($Desc, '<div class="brand">')-1), StringLen($Desc) - StringInStr($Desc, "</a>", 0, 2)+1) $Brand = StringRight($Brand, StringLen($Brand) - StringInStr($Brand, "More ")-4) ElseIf StringInStr($Desc, '<div class=brand>') Then $Brand = StringTrimRight(StringTrimLeft($Desc, StringInStr($Desc, '<div class=brand>')-1), StringLen($Desc) - StringInStr($Desc, "</a>", 0, 2)+1) $Brand = StringRight($Brand, StringLen($Brand) - StringInStr($Brand, "More ")-4) ElseIf StringInStr($Desc, 'Brand: ') Then $Brand = StringTrimLeft($Desc, StringInStr($Desc, 'Brand: ')+6) $Brand = StringLeft($Brand, StringInStr($Brand, '</li>')-1) EndIf Return $Brand EndFunc Func _HTMLGetWarranty($Warranty) $Warranty = StringTrimLeft(StringTrimRight($Warranty, StringLen($Warranty) - StringInStr($Warranty, '</p>')+1), StringInStr($Warranty, '<p>')+2) If $Warranty = 'This product comes with a warranty covered by either oo.com.au or the supplier of this product.' Then $Warranty = 'This product comes with a warranty.' EndIf Return $Warranty EndFunc Func _HTMLGetCost($Main) If StringInStr($Main, '<P class=was>') Then $Cost = StringTrimRight(StringTrimLeft($Main, StringInStr($Main, '<P class=was>')+24), StringLen(StringTrimLeft($Main, StringInStr($Main, '<P class=was>')+24))-StringInStr(StringTrimLeft($Main, StringInStr($Main, '<P class=was>')+24), '</span>')+1) Else $Cost = StringTrimLeft(StringTrimRight($Main, StringLen($Main)-StringInStr($Main, "</strong>")+1), StringInStr($Main, "<P class=price>Our Price: <strong>")+34) EndIf Return $Cost EndFunc Func _Images() Local $Image, $Width, $Height ;~ _ArrayDisplay($PImagesArray) $ImagesGuiArray[0] = GUICreate("Images", 600, 680) GUISetBkColor(0xd0d0d0, $ImagesGuiArray[0]) $ImagesGuiArray[1] = GUICtrlCreateButton("<", 245, 610, 30, 30) GUICtrlSetOnEvent($ImagesGuiArray[1], '_PrevImage') $ImagesGuiArray[2] = GUICtrlCreateButton("Edit", 285, 610, 30, 30) GUICtrlSetOnEvent($ImagesGuiArray[2], '_EditImage') $ImagesGuiArray[3] = GUICtrlCreateButton(">", 325, 610, 30, 30) GUICtrlSetOnEvent($ImagesGuiArray[3], '_NextImage') $ImagesGuiArray[4] = GUICtrlCreateLabel("", 245, 645, 105, 30, 0x01) GUICtrlSetState($ImagesGuiArray[1], 128) If UBound($PImagesArray) = 1 Then GUICtrlSetState($ImagesGuiArray[3], 128) EndIf If UBound($PImagesArray)>8 Then $PImagesArrayLimit = 8 Else $PImagesArrayLimit = UBound($PImagesArray)-1 EndIf _CreateImage() GUISetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $ImagesGuiArray[0]) While 1 WEnd EndFunc Func _CreateImage() If StringLeft($PImagesArray[0], 4) = 'http' Then InetGet($PImagesArray[0], @TempDir&"\Pic.jpg", 16, 0) Else FileWrite(@TempDir&"\Pic.jpg", FileRead($ImagesDirectory&"\"&$PNum&" 0.jpg")) EndIf $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Width = 600 ElseIf $Height > $Width Then $Width = 600*($Height/$Width) $Height = 600 Else $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", 0, 0, $Width, $Height) $ThisImage = 0 GUICtrlSetData($ImagesGuiArray[4], "Image 1 of "&UBound($PImagesArray)) Return EndFunc Func _NextImage() GUICtrlSetState($ImagesGuiArray[1], 255) $ThisImage += 1 GUICtrlSetData($ImagesGuiArray[4], "Image "&$ThisImage&" of "&UBound($PImagesArray)) If StringLeft($PImagesArray[$ThisImage], 4) = 'http' Then InetGet($PImagesArray[$ThisImage], @TempDir&"\Pic.jpg", 16, 0) Else FileDelete(@TempDir&"\Pic.jpg") FileWrite(@TempDir&"\Pic.jpg", FileRead($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg")) EndIf $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Top = 300 - (0.5*$Height) $Width = 600 $Left = 0 ElseIf $Height > $Width Then $Width = 600*($Width/$Height) $Left = 300 - (0.5*$Width) $Height = 600 $Top = 0 Else $Left = 0 $Top = 0 $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) GUICtrlDelete($Pic) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", $Left, $Top, $Width, $Height) If $ThisImage = UBound($PImagesArray)-1 Then GUICtrlSetState($ImagesGuiArray[3], 128) EndIf Return EndFunc Func _EditImage() Local $Label, $ImageURL GUICtrlDelete($Pic) $Label = GUICtrlCreateLabel("Waiting for Microsoft Paint to close.", 220, 290) RunWait("mspaint "&@TempDir&"\Pic.jpg", @TempDir, @SW_SHOW) $PImagesArray[$ThisImage] = $ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg" FileDelete($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg") FileWrite($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg", FileRead(@TempDir&"\Pic.jpg")) $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Top = 300 - (0.5*$Height) $Width = 600 $Left = 0 ElseIf $Height > $Width Then $Width = 600*($Width/$Height) $Left = 300 - (0.5*$Width) $Height = 600 $Top = 0 Else $Left = 0 $Top = 0 $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", $Left, $Top, $Width, $Height) GUICtrlDelete($Label) EndFunc Func _PrevImage() GUICtrlSetState($ImagesGuiArray[3], 255) $ThisImage -= 1 GUICtrlSetData($ImagesGuiArray[4], "Image "&$ThisImage&" of "&UBound($PImagesArray)) If StringInStr($PImagesArray[$ThisImage], 'http') Then InetGet($PImagesArray[$ThisImage], @TempDir&"\Pic.jpg", 16, 0) Else FileDelete(@TempDir&"\Pic.jpg") FileWrite(@TempDir&"\Pic.jpg", FileRead($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg")) EndIf $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Top = 300 - (0.5*$Height) $Width = 600 $Left = 0 ElseIf $Height > $Width Then $Width = 600*($Width/$Height) $Left = 300 - (0.5*$Width) $Height = 600 $Top = 0 Else $Left = 0 $Top = 0 $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) GUICtrlDelete($Pic) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", $Left, $Top, $Width, $Height) If $ThisImage = 0 Then GUICtrlSetState($ImagesGuiArray[1], 128) EndIf Return EndFunc Func _Price($FinalPrice) $FinalPrice = 1.3*$FinalPrice If $FinalPrice > 15 Then Local $FinalPriceArray = StringSplit($FinalPrice, ".", 3) If UBound($FinalPriceArray) = 1 Then _ArrayAdd($FinalPriceArray, 0) EndIf If StringRight($FinalPriceArray[0], 1) & "." & $FinalPriceArray[1] >= 2.45 And StringRight($FinalPriceArray[0], 1) & "." & $FinalPriceArray[1] < 7.45 Then $FinalPrice = StringLeft($FinalPriceArray[0], StringLen($FinalPriceArray[0])-1)&"4.95" Else If StringRight($FinalPriceArray[0], 1) > 5 Then $FinalPrice = StringLeft($FinalPriceArray[0], StringLen($FinalPriceArray[0])-1)&"9.95" Else $FinalPrice = (StringLeft($FinalPriceArray[0], StringLen($FinalPriceArray[0])-1)&"9.95")-10 EndIf EndIf EndIf ;~ MsgBox(0,"",$FinalPrice) Return $FinalPrice EndFunc Func _GetSearchTags($SearchTags) Local $DontAllow[4] = [" ", ",", "-", "&amp"] For $Repeat = 0 To UBound($DontAllow)-1 $SearchTags = StringReplace($SearchTags, $DontAllow[$Repeat], "|") Next While StringInStr($SearchTags, "||") $SearchTags = StringReplace($SearchTags, "||", "|") WEnd Return $SearchTags EndFunc Func _GetSEOKeywords($Keywords) Local $DontAllow[4] = [" ", ",", "-", "&amp"] For $Repeat = 0 To UBound($DontAllow)-1 $Keywords = StringReplace($Keywords, $DontAllow[$Repeat], ",") Next While StringInStr($Keywords, ",,") $Keywords = StringReplace($Keywords, ",,", ",") WEnd Return $Keywords EndFunc Func _Exit() Switch @GUI_WinHandle Case $GuiArray[0] Exit Case $ImagesGuiArray[0] GUIDelete($ImagesGuiArray[0]) _CreateGUI() Case $ProdNumGuiArray[0] $Exit = MsgBox(4,"Exit Now?", "Are you sure you want to exit?") If $Exit = 6 Then Exit Else Return EndIf Case Else GUIDelete(@GUI_WinHandle) ;DataGuiArray[0] EndSwitch EndFunc Func _OnExit() GUIDelete($GuiArray[0]) _GDIPlus_Shutdown() EndFunc Func _Delivery($Main) Local $Delivery ;$Delivery = StringTrimLeft($PMain, StringInStr($PMain, '<p class=delivery>', 0)+36) ;$Delivery = StringTrimRight(StringTrimLeft($Delivery, StringInStr($Delivery, "$")-1), StringLen($Delivery)-StringInStr($Delivery, ".")-2) Local $Delivery = StringRegExp($Main, '<P class=delivery>([\S\s]*?)<\/P>', 1) $Delivery = StringRegExp($Delivery[0], '<STRONG>([\S]+)<\/STRONG>', 1) $Delivery[0] = StringTrimLeft($Delivery[0], 1) ;~ MsgBox(0,"",$Delivery[0]) Return $Delivery[0] EndFunc Func _GetSEODescription($Desc2) $Desc2 = _HTML2PlainText($Desc2);StringRegExpReplace($Desc2, "(<[^>]+?>)", "") $Desc2 = _RemExtraLineBreaks($Desc2);StringReplace($Desc2, @CRLF&@CRLF, @CRLF, 0) Return $Desc2 EndFunc Func _HTML2PlainText($sHtml) $sHtml = StringRegExpReplace($sHtml, "<br[^>]*\/>", @CRLF) $sHtml = StringRegExpReplace($sHtml, "<\/?p[^>]*>", @CRLF & @CRLF) $sHtml = StringRegExpReplace($sHtml, '(<[^>]+>)', '') Return $sHtml EndFunc Func _RemExtraLineBreaks($sTxt) $sTxt = StringRegExpReplace($sTxt, "[\s][\s]+", @CRLF) Return $sTxt EndFunc Func _IsURL($URL) Select Case StringInStr($URL, ".com") Return True Case StringInStr($URL, ".net") Return True Case StringInStr($URL, ".org") Return True Case StringInStr($URL, ".gov") Return True Case StringInStr($URL, ".edu") Return True Case StringInStr($URL, ".biz") Return True Case Else Return False EndSelect EndFunc Func _Restart() GUIDelete($GuIArray[0]) _Start() EndFunc Does anybody have the same problem? Thanks.
  14. Its been asked before and I can't seem to find any UDF or built in feature with support for Logging in AutoIt, but I thought it wouldn't hurt to ask and spark some focus on the matter. Applications built for in house use to be run by those that develop them really isn't an issue. It becomes useful to troubleshoot an application if it utilizes some sort of Logging. It is feasible to write functions to support such a need, but I would be pleased if I could find someone who is a far better programmer than I had visited this so I don't have to divert attention and implement it into projects. What I'm looking for is something similar to NLog or Log4Net with the ability to log events as they happen for ease of troubleshooting if an application fails. I'm aware of Opt("GUIOnEventMode", 1) but that isn't useful if the end user is not the developer and where screenshots are not desired. I'm not trying to compare Autoit to .NET in any way. I'm just trying to achieve logging capabilities that match those applications mentioned. I have considered AutoItX and recoding the project in .NET except for the components that are essentially AutoIt only capable, but that is a bit extreme for my immediate needs.
  15. MouseOnEvent UDF!

    This UDF allows to set an events handler for Mouse device. The beginning... I searched for a way to disable the Mouse Primary click, and be able to call some function when the click event is received... Big thanks to amel27 for this one, i only organized the whole stuff to UDF style. Example: #include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") _Example_Intro() _Example_Limit_Window() Func _Example_Intro() MsgBox(64, "Attention!", "Let's set event function for mouse wheel *scrolling* up and down", 5) ;Set event function for mouse wheel *scrolling* up/down and primary button *down* action (call our function when the events recieved) _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "_MouseWheel_Events") _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "_MouseWheel_Events") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event") Sleep(3000) ;UnSet the events _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT) _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ToolTip("") MsgBox(64, "Attention!", "Now let's disable Secondary mouse button up action, and call our event function.", 5) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseSecondaryUp_Event", 0, 1) Sleep(5000) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) ToolTip("") EndFunc Func _Example_Limit_Window() Local $hGUI = GUICreate("MouseOnEvent UDF Example - Restrict events on specific window") GUICtrlCreateLabel("Try to click on that specific GUI window", 40, 40, 300, 30) GUICtrlSetFont(-1, 12, 800) GUICtrlCreateLabel("Press <ESC> to exit", 10, 10) GUISetState() _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event", $hGUI) ;A little(?) bugie when you mix different events :( ;_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseSecondaryUp_Event", $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN MsgBox(0, "", "Should not be shown ;)") EndSwitch WEnd _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ;_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) EndFunc Func _MouseWheel_Events($iEvent) Switch $iEvent Case $MOUSE_WHEELSCROLLDOWN_EVENT ToolTip("Wheel Mouse Button (scrolling) DOWN Blocked") Case $MOUSE_WHEELSCROLLUP_EVENT ToolTip("Wheel Mouse Button (scrolling) UP Blocked") EndSwitch Return $MOE_BLOCKDEFPROC ;Block EndFunc Func _MousePrimaryDown_Event() ToolTip("Primary Mouse Button Down Blocked") Return $MOE_BLOCKDEFPROC ;Block EndFunc Func _MouseSecondaryUp_Event() ToolTip("Secondary Mouse Button Up Blocked") EndFunc Func _Quit() Exit EndFunc Available Events Constants: ------------------------------------------ CHANGELOG: Download: Attached: MouseOnEvent.zip - v2.3 Old version: MouseOnEvent_2.1.zip MouseOnEvent_2.0.zip MouseOnEvent_UDF_1.9.zip MouseSetOnEvent_UDF_1.8.zip MouseSetOnEvent_UDF_1.7.zip MouseSetOnEvent_UDF_1.6.zip MouseSetOnEvent_UDF_1.5.zip MouseSetOnEvent_UDF_1.4.zip MouseSetOnEvent_UDF_1.3.zip Previous downloads: 146 + 200 + 804 MouseOnEvent.zip MouseOnEvent.zip