Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/01/2017 in all areas

  1. Version 3: Ops, you may ask, where's the version 2? The answer is, you will never see it. I skipped it to jump to version 3 directly. Why? Actually, I didn't learn M$ about that versioning The reason is, I planed to write version 2, using the new window/control handle indexing technique to eliminate all the ugly and slow loop. But when nearly finish, I feel so tired, tired of using a lots of all workaround. And finally, I decided to rewrite entire the UDF, using the direct solution, the way all other languages used, and should use. I late some day, because of some machine code (it's actually not so necessary, but if the control is doing an expensive task, like heavy drawing then passing all the Window Message to AutoIt is not a so good idea because its slow speed may result in some annoying-small-but-easy-to-figure-out problems, (like tearing as example). So I use machine code directly to pass over it. Now you have not a Stupid but a Smart UDF And it's still simple. API change: Remove a parameter from _SSCtrlHover_Register. You nolonger can attach other controls to the registered control. Use another method to do it and when you delete the control be sure to delete all the attached controls yourself. This breaks your old script. Add double click event (last 2 parameters of _SSCtrlHover_Register) Remove the _SSCtrlHover_Delete. You must manually delete yourself. It's easy with GUICtrlDelete and I decide not to duplicate this function to my UDF (be sure to delete your attached control too) This version eliminate all the odd limit of old version, include: No:longer use timer/adlib to test the control is on mouse event. Now it directly use native WinAPI method to provide a truly event-driven way. Every click is detected, every mouse hover/left, is handled perfectly. Fast and very fast. All the loop is eliminated. Machine code. Execute speed is much much improved. (read as: nano seconds instead of milliseconds ) I documented it quite well so if you want you can easily browse it and change it the way you want. Now you can use in both GUIGetMsg() loop mode or event mode. No longer setting constants like before because it works perfectly in both mode. Cheer Remark: I don't include <WinAPI.au3> and <WinAPIShellEx.au3> in my UDF, because those UDF is very large and it will consume much more memory when you run (not matter you run the 'compiled' exe, the au3 file, or the .a3x file). In the CtrlHover UDF, i included a small subset of those UDF with the same name, so if you have already included <WinAPI.au3> or <WinAPIShell.au3>, be sure to edit the UDF and comment out the corresponding region. Edit 2: Reorganize script. Fix some issues when drag too fast. Add ability to handle "click" (work RIGHT as normal button, will not fire if you only release the mouse button upon the control as some UDF use MouseUp event) Add a helper method to check if MouseUp event is click event or not. Add compability function to call as normal UDF (with first letter is underscore). Edit 1: Add some function descriptions as JS's advice. Thank you I also changed script name (shorter) and modify the register function so it may be called with less parameter. From now on, the function name and calling syntax will be fixed. OK, I know there is the famous "GUICtrlOnHover" UDF already in this forum, and many people have used it and enjoyed it! But the UDF didn't work as I expected . So I wrote an UDF myself, as much simple as possible, and it works out of the box It has some advantages compare to the old GUICtrlOnHover.au3 It creates the normal button behavior. When you press primary mouse button in the control and begin to drag, it do not set other controls to "hover" state. Faster. I try to add 2k controls. When mouse change from one control to another, it only take about 25ms to handle. In idle state (mouse cursor is not over any control), the cost is ignorable with < 0.1ms. Compare with GUICtrlOnHover UDF takes about 3ms when mouse cursor is over the control, but in idle state, it takes about 35ms. (I do not know why) (That is, because I tested script with overlapped controls. GUICtrlOnHover rely on WinAPI function WindowFromPoint(), which return the first created control (the control with is overlapped any others), but my script rely on GUIGetCursorInfo() which return the last created control - which is the most nested control in Windows). So my script need to check entire 2k control, but GUICtrlOnHover return the first element. I will wait for information about GUIGetCursorInfo() to decide that my UDF should use WinAPI function instead of the native function. In the normal usecase and controls is not overlapped, my UDF is far faster. Edit: Add a setting constant, make you ability to choose use WindowFromPoint() or GUIGetCursorInfo(). Default to the WinAPI function) Faster time to create/ register control. Native AutoIt. No Callback. The only DllCall I use is to get parent window of a control. Wonder why AutoIt do not have a similar function. Found a new bug #2899. If someone can ad more functinal to WinGetHandle("[LAST]"), it should be great Edit: Use some other WinAPI call to provide workaround for issue with GUIGetCursorInfo. Smaller size, about 280 lines compare with about 400 lines of GUICtrlOnHover. More simple, more easy to use. No more than 120 characters in one line. No annoying jumping when scroll the UDF Support event mode to detect mouse down event. But it doesn't work with overlay control. So you cannot have a control (with event) over another control. (use $_BGUIGETCURSORINFOFIX const setting to get rid of this). It seems that it's a AutoIt bug, the GUIGetCursorInfo return a useless control id when controls overlapped. Its not the same with the control received with WindowFromPoint(), or the control which fire event (anyone can confirm it's a bug? Or it's a special feature? ) ( I open a new Trac Ticket here: #2900) Current limit: Mouse down Almost all mouse event is currently detected by timeout (this is why the script called Simple and Stupid, but every UDF I found in this forum also use this method). You can set a smaller timeout to catch the mouse, but sometimes its annoying. Edit: Default changed to 30ms timeout, it should be fast enough to detect any click! You can also change to use event mode to detect click better! Otherwise, it works like a charm. Try it and happy with it Example: Callback function #include "SSCtrlHover.au3" GUICreate(@AutoItVersion) $idLbl1 = GUICtrlCreateLabel("Label 1", 5, 5) SSCtrlHover_Register($idLbl1, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 0) $idLbl2 =GUICtrlCreateLabel("Label 2", 5, 35) SSCtrlHover_Register($idLbl2, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 5) GUISetState() While GUIGetMsg() <> -3 Sleep(10) WEnd Func FnNormal($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Normal/Leave " & $idCtrl) EndFunc Func FnHover($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Hover " & $idCtrl) EndFunc Func FnActive($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Active " & $idCtrl) EndFunc Func FnClick($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "CLICK! " & $idCtrl & " - " & $hWnd & " - " & $vData) EndFunc You can use it with GUICtrlSetImage to provide a "hover button" effect Version 1: SSCtrlHover.au3 Version 3: SSCtrlHover.zip
    1 point
  2. It is the fruit of my last job. You can easily manage certificates in Windows. Still beta so please make a comment. Regards, mLipok
    1 point
  3. mLipok

    CertUtil UDF

    Version 0.0.3

    641 downloads

    It is the fruit of my last job. You can easily manage certificates in Windows. Remark: Still beta so please make a comment in Support topic:
    1 point
  4. No one is deleting anything. I simply don't understand why you're incapable of answering two simple questions: WHAT isn't working in AutoIt (from thread one) and WHY is the CPU usage of such concern (this thread) - unless there is no basis for your complaint. My "bossy" attitude usually comes out when people state in multiple threads that the language is lacking or needs to be updated, without providing a concrete reason behind it. That said, we'll let others weigh in. If your desire for an update to address this CPU usage is enough to spur Jon into a new development cycle, then hooray for all. If that happens, I will even apologize for hurting your feelings. Edit: Just saw your report, not sure what you think I deleted; I have deleted nothing you have typed, merely merged two threads into one.
    1 point
  5. iamtheky

    StringRegExp (no - mix)

    You could add the three new characters to jchd's exclusion list, and do a preliminary check for double+ spaces $input="73 8249 572a sdf78 -_-" If stringstripWS($input , 4) = $input Then $sOut = StringRegExp($input, '(?i)^[a-z\d\-\_\s]*$') Else $sOut = 0 EndIf msgbox(0, '' , $sOut)
    1 point
  6. Why do you check $match for a string value, and then attempt to use it as an object that has elements? This works for me acted too quickly, this seems to be working fine #include<file.au3> $match = "value" If $match = "value" Then _FileWriteLog ("c:\folder\data.xml","<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?>") _FileWriteToLine ("c:\folder\data.xml", 1, "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?>", 1) _FileWriteToLine ("c:\folder\data.xml", 2, "<Key>", 1) _FileWriteToLine ("c:\folder\data.xml", 3, "<Value1>" & $match & "</Value1>", 1) _FileWriteToLine ("c:\folder\data.xml", 4, "</Key>", 1) EndIf If FileExists ( "c:\folder\data.xml" ) Then msgbox(0, '' , "do the thing") Else MsgBox ( 4096 , "Error" , "data.xml file not present." ) EndIf
    1 point
  7. jchd

    StringRegExp (no - mix)

    StringRegExp($input, '(?i)^[a-z\d]*$') should do it, returning a boolean True if accepted.
    1 point
  8. Hi Experts, I know this is just a small issue for guys out there but can't find how to fix this. My problem is, when I added text in EditBox with more than one paragraph (I mean not in one line text), FileWriteLine() won't present it as one line when "GUICtrlRead($Edit)" even if using delimiters "|". I have here the code: $file = "D:\Programs\Text.ini" FileWriteLine($file, GUICtrlRead($InputName)&"|"&GUICtrlRead($Count)&"|"&$AllFormat&"|"&GUICtrlRead($Edit)&"|"&@UserName&"|"&$aFormat&"|"&@MON & "/" & @MDAY & "/" & @YEAR&"|"&@HOUR & ":" & @MIN & ":" & @SEC&"|"&$Status&"|"&$Remark) EditBox text presented as: This is just a sample text. This is another text here. Last text here. FileWriteLine() output is this: ABZ12345|50|Parsing| This is just a sample text. This is another text here. Last text here.|@username|Others|@MON/@MDAY/@YEAR|@HOUR:@MIN:@SEC|Pending|For Fixing The bold font were the one being separated to another line in $file which should be in one line only. Like below: ABZ12345|50|Parsing|This is just a sample text. This is another text here. Last text here.|@username|Others|@MON/@MDAY/@YEAR|@HOUR:@MIN:@SEC|Pending|For Fixing Any idea guys? Thanks in advance Experts. KS15
    1 point
  9. Open the Helpfile and search for: FileFindFirstFile / FileFindNextFile / _FileListToArray Run / ShellExecute Send() / ControlSend() ProcessClose() For ... Next Can't be that hard Jos
    1 point
  10. Use StringReplace(GuiCtrlRead($InputName), @CRLF, " ") or replace it with something indicating the newline.
    1 point
×
×
  • Create New...