Leaderboard
Popular Content
Showing content with the highest reputation on 05/03/2013 in all areas
-
mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples1 point
-
One of the main issues AutoIt coder could have is lack of built-in data compression mechanism. Doing it "manually" is not an option because of the slowness of the interpretter. So, it's either using third party dlls (whatever) or some Windows API that exposes the funcionality. In this post I will compress data using well known GDI+. That's graphical library, so it's not straightforward approach. First I'm making BITMAP out of data and then convert that image into a PNG. PNG format includes form of compression, so at the end what's get is compressed data. Compression level is not very high compared to other methods, but considering everything - who cares . Of course that compressing string "ABC" will not make much sense and will result in, IDK 150 bytes of output because PNG includes metadata that take space, but for data in sizes of more than few KB you will see the difference. Besides you will see how your data looks if it's taken to be a picture. Script will create PNG out of itself called Test_Image.png and then read it and print to console: GDIP_Compress.au31 point
-
[help] Adding unknown function search
tonyatcodeleakers reacted to SmOke_N for a topic
Posting a txt file with an example of the input string would be nice. This is pseudo code, not tested at all or even syntax checked. But is a direction I would take: #include <Array.au3> ; pass the edit areas text to function ; should return unknown function(s) array Global $gh_EditControl = 0 ; put something here Global $gs_EditText = _GUICtrlRichEdit_GetText($gh_EditControl) Global $ga_UnknownFuncs = _gsc_getUnknownFuncs($gs_EditText) If @error Then MsgBox(16 + 262144, "Error", "Track down SetError(" & @error & ", 0, 0)") Else _ArrayDisplay($ga_UnknownFuncs, "Unknown Funcs") EndIf Func _gsc_getUnknownFuncs($s_intext) If StringLen(StringStripWS($s_intext, 8)) = 0 Then ; invalid string Return SetError(1, 0, 0) EndIf Local $a_srefuncs = StringRegExp($s_intext, "(?ims)(?:\:\:|thread\s+)(\w+)", 3) If @error Then ; no functions found Return SetError(2, 0, 0) EndIf ; get a unique array Local $a_funcs = _ArrayUnique($a_srefuncs) Local $s_unknown = "", $s_pattern Local $s_patternend = "\E\s*\((?:[\w\s,]*)\)\v*\{" For $ifunc = 0 To UBound($a_funcs) - 1 ; find functions with parenthesis and curly bracket ext after (possible) vertical space line ; allow for possible parameters (eg. [\w\s,]) $s_pattern = "(?is)\W\Q" & $a_funcs[$ifunc] & $s_patternend If Not StringRegExp($s_intext, $s_pattern) Then $s_unknown &= $a_funcs[$ifunc] & @LF EndIf Next $s_unknown = StringTrimRight($s_unknown, 1) If Not $s_unknown Then ; no unknown functions found Return SetError(3, 0, 0) EndIf ; return 1 dimension array of unknown funcs Return StringSplit($s_unknown, @LF) EndFunc1 point -
#include <Date.au3> #include <WinAPI.au3> Local $Starttime = "14:40:30" ; IniRead("settings.ini", "SectionstartTime", "Starttime", "Start Time Note Set") Local $Endtime = "14:41:00" ; IniRead("settings.ini", "SectionendTime", "Endtime", "End Time Note Set") $maxseconds = _DateDiff('s', @YEAR & "/" & @MON & "/" & @MDAY & " " & $Starttime, @YEAR & "/" & @MON & "/" & @MDAY & " " & $Endtime) ConsoleWrite($maxseconds & @CRLF) $gui = GUICreate("") GUISetState(@SW_SHOW) While 1 $cur = _DateDiff('s', @YEAR & "/" & @MON & "/" & @MDAY & " " & $Starttime, @YEAR & "/" & @MON & "/" & @MDAY & " " & _NowTime(5)) If $cur >=0 and $cur < $maxseconds Then ; if in the range If Not BitAND(WinGetState($gui), 2) Then GUISetState(@SW_SHOW) WinSetOnTop($gui,"",1) MsgBox(0, "Running", "From " & $Starttime & " to: " & $Endtime,5) EndIf _WinAPI_FlashWindow($gui) Sleep (500) Else If BitAND(WinGetState($gui), 2) Then WinSetOnTop($gui,"",0) GUISetState(@SW_HIDE) MsgBox(0, "Pause", "HIDE, outsid of range " & $Starttime & " to: " & $Endtime,5) EndIf EndIf Sleep(100) WEnd1 point
-
Need to build an auto-replace text files
DucViet321 reacted to abberration for a topic
Here something to get you started. It reads your data.txt file. When it finds the phrase "Question:", it starts putting the questions and answers into an array. For an example, I used _arraydisplay to show you the full array. I also gave an example of making it chose a random question. On the array, you have the following: $globalArray[<question number>][0] = the question $globalArray[<question number>][1] = choice #1 $globalArray[<question number>][2] = choice #2 $globalArray[<question number>][3] = choice #3 $globalArray[<question number>][4] = choice #4 $globalArray[<question number>][5] = correct answer #include <file.au3> #include <array.au3> $dataFile = @ScriptDir & "\data.txt" $dataFileSize = _FileCountLines($dataFile) Dim $globalArray[1][6] _ReadQuestionsToArray() _ArrayDisplay($globalArray) $arraySize = UBound($globalArray, 1) $randomQuestion = Round(Random(0, $arraySize - 1), 0) MsgBox(0, "", $globalArray[$randomQuestion][0]) Func _ReadQuestionsToArray() $numOfQuestions = 0 For $i = 1 to $dataFileSize Step 1 $lineRead = FileReadLine($dataFile, $i) If StringInStr($lineRead, "Question:") Then $globalArray[$numOfQuestions][0] = StringReplace($lineRead, "Question: ", "") For $j = 1 to 4 step 1 $lineRead = FileReadLine($dataFile, $i + $j) $globalArray[$numOfQuestions][$j] = StringReplace($lineRead, "Choice: ", "") Next $lineRead = FileReadLine($dataFile, $i + $j) $globalArray[$numOfQuestions][5] = StringStripWS(StringReplace($lineRead, "Correct:", ""), 8) $numOfQuestions += 1 ReDim $globalArray[$numOfQuestions + 1][6] EndIf Next ReDim $globalArray[$numOfQuestions][6] EndFunc1 point -
If there aren't many items, i would use and array and then _GUICtrlListView_GetItemFocused($hWnd, $iIndex) if true then _GUICtrlListView_SetItemFocused($hWnd, $iIndex, False) Or _GUICtrlListView_GetItemCount($hWnd) and unfocus all _GUICtrlListView_SetItemFocused($hWnd, $iIndex, False)1 point
-
I'm currently in this project, for autosuggestion. Will post when the script is ready Regards1 point
-
it would require a couple of increase in the code. Just for curiosity, what is the problem with this #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") Global Const $WS_EX_NOACTIVATE = 0x08000000 Global $hMainGUI = GUICreate("Main GUI", -1, -1, -1, -1, $WS_POPUP, $WS_EX_NOACTIVATE) Global $iList = GUICtrlCreateList("Create Child Win", 10, 10, 200, 100) GUICtrlSetData($iList, "Data1|Data2|Data3|Data4|Data1|Data2|Data3|Data4|Data1|Data2|Data3|Data4|So on...") GUISetState(@SW_SHOWNOACTIVATE) Global $hWnd, $iList While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iList ConsoleWrite("list" & @CRLF) EndSwitch WEnd Func Terminate() Exit EndFunc ;==>Terminate1 point
-
Does this work for you ? #include-once #include <WinAPI.au3> #include <GUIListBox.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> HotKeySet("{ESC}", "Terminate") OnAutoItExitRegister("Cleanup") ;WH_MOUSE_LL - Check Msdn Global Const $tagMSLLHOOKSTRUCT = 'int x;int y;DWORD mouseData;DWORD flags;DWORD time;ULONG_PTR dwExtraInfo' Global $hModule = _WinAPI_GetModuleHandle(0) Global $hMouseProc = DllCallbackRegister("LowLevelMouseProc", "long", "int;wparam;lparam") Global $pMouseProc = DllCallbackGetPtr($hMouseProc) Global $hMouseHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pMouseProc, $hModule) ;The Message to check for Global $iCheck = $WM_LBUTTONDOWN Global $hWnd = GUICreate("GUI_WithNoFocus", 500, 600, -1, -1, -1, $WS_EX_TOPMOST) Global $iBtn = GUICtrlCreateList("", 10, 10) GUICtrlSetData(-1, "Row1|Row2|Row3|Row4|Row5", "Row4") GUISetState(@SW_SHOWNOACTIVATE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iBtn ConsoleWrite("ListBox Clicked" & @CRLF) EndSwitch WEnd ; http://msdn.microsoft.com/en-us/library/ms644986(v=vs.85).aspx Func LowLevelMouseProc($nCode, $wParam, $lParam) Local $tPoint = _WinAPI_GetMousePos() Local $hActive = _WinAPI_WindowFromPoint($tPoint) Local $hParent = _WinAPI_GetParent($hActive) ;No need to process if the window is activated. If WinGetHandle("[ACTIVE]") = $hParent Then Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam) If $nCode >= 0 And ($wParam = $iCheck) And ($hParent = $hWnd Or $hActive = $hWnd) Then ; http://msdn.microsoft.com/en-us/library/ms644970(v=vs.85).aspx Local $MSLLHOOKSTRUCT = DllStructCreate($tagMSLLHOOKSTRUCT, $lParam) Local $iRealClick = (DllStructGetData($MSLLHOOKSTRUCT, 'flags') = 0) ;The Click is real, not injected(or simulated) Local $iClickOnClient = _IsCLickOnClient($hWnd, DllStructGetData($MSLLHOOKSTRUCT, 1), DllStructGetData($MSLLHOOKSTRUCT, 2)); Clicked at Client-Area ;Block if the event is real and on the client area only If $iRealClick And $iClickOnClient Then ; $iIndex = _GUICtrlListBox_ItemFromPoint($hActive, _WinAPI_GetMousePosX(True, $hActive), _WinAPI_GetMousePosY(True, $hActive)) _SendMessage($hActive, $LB_SETCURSEL, $iIndex) ;Change the selection ;Send Parent the notification $iControlID = _WinAPI_GetDlgCtrlID($hActive) $iWParam = _WinAPI_MakeLong($iControlID, $LBN_SELCHANGE) _SendMessage($hParent, $WM_COMMAND, $iWParam, $hActive) Return 1 ;Block the Main Click EndIf EndIf Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam) EndFunc ;==>LowLevelMouseProc Func _IsCLickOnClient($hWnd, $iX, $iY) $tRect = _WinAPI_GetClientRect($hWnd) $tPoint = DllStructCreate($tagPoint) DllStructSetData($tPoint, 1, 0) DllStructSetData($tPoint, 2, 0) _WinAPI_ClientToScreen($hWnd, $tPoint) DllStructSetData($tRect, 1, DllStructGetData($tPoint, 1)) DllStructSetData($tRect, 2, DllStructGetData($tPoint, 2)) DllStructSetData($tRect, 3, DllStructGetData($tPoint, 1) + DllStructGetData($tRect, 3)) DllStructSetData($tRect, 4, DllStructGetData($tPoint, 2) + DllStructGetData($tRect, 4)) DllStructSetData($tPoint, 1, $iX) DllStructSetData($tPoint, 2, $iY) Return _WinAPI_PtInRect($tRect, $tPoint) EndFunc ;==>_IsCLickOnClient Func Cleanup() _WinAPI_UnhookWindowsHookEx($hMouseHook) DllCallbackFree($hMouseProc) EndFunc ;==>Cleanup Func Terminate() Exit EndFunc ;==>TerminateThe script satisfies the same functions as specified above just replace button with list. For keyboard support you need to send WM_VKEYTOITEM and WM_CHARTOITEM with a keyboard hook or with GUISetAccelerators. Thumbs up if helped Regards1 point
-
Oh, only half read your need...you can add TITLE:|REGEXPTITLE: into the []: Or, add an additional step in each loop...WinGetTitle, and check if it matches your string...else skip the minimize TITLE - Window titleCLASS - The internal window classnameREGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2)REGEXPCLASS - Window classname using a regular expression (if the regular expression is wrong @error will be set to 2)LAST - Last window used in a previous AutoIt commandACTIVE - Currently active windowX Y W H - The position and size of a windowINSTANCE - The 1-based instance when all given properties match1 point
-
This instead should help you more #include <GUIConstantsEx.au3> HotKeySet("{ESC}", "Terminate") Global Const $WS_EX_NOACTIVATE = 0x08000000 Global $hMainGUI = GUICreate("Main GUI", -1, -1, -1, -1, -1, $WS_EX_NOACTIVATE) Global $iList = GUICtrlCreateList("Create Child Win", 10, 10) GUICtrlSetData($iList, "Data1|Data2|Data3|Data4|So on...") GUISetState(@SW_SHOWNOACTIVATE) Global $hWnd, $iList While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func Terminate() Exit EndFunc ;==>TerminateRegards1 point
-
The following script can send the click to the button without setting focus to the parent. Functions Supports only Left Click and Button controlsThe parent doesn't get focus.The script won't block the click event when over non-client areaThe script would block the real clicks not the simulated one.#include-once #include <WinAPI.au3> #include <ButtonConstants.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> HotKeySet("{ESC}", "Terminate") OnAutoItExitRegister("Cleanup") ;WH_MOUSE_LL - Check Msdn Global Const $tagMSLLHOOKSTRUCT = 'int x;int y;DWORD mouseData;DWORD flags;DWORD time;ULONG_PTR dwExtraInfo' Global $hModule = _WinAPI_GetModuleHandle(0) Global $hMouseProc = DllCallbackRegister("LowLevelMouseProc", "long", "int;wparam;lparam") Global $pMouseProc = DllCallbackGetPtr($hMouseProc) Global $hMouseHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pMouseProc, $hModule) ;The Message to check for Global $iCheck = $WM_LBUTTONDOWN Global $hWnd = GUICreate("GUI_WithNoFocus", 500, 600, -1, -1, -1, $WS_EX_TOPMOST) Global $iBtn = GUICtrlCreateButton("Click Me", 10, 10) Global $hBtn = GUICtrlGetHandle(-1) GUISetState(@SW_SHOWNOACTIVATE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iBtn ConsoleWrite("Button Clicked" & @CRLF) EndSwitch WEnd ; http://msdn.microsoft.com/en-us/library/ms644986(v=vs.85).aspx Func LowLevelMouseProc($nCode, $wParam, $lParam) Local $tPoint = _WinAPI_GetMousePos() Local $hActive = _WinAPI_WindowFromPoint($tPoint) Local $hParent = _WinAPI_GetParent($hActive) If $nCode >= 0 And ($wParam = $iCheck) And ($hParent = $hWnd Or $hActive = $hWnd) Then ; http://msdn.microsoft.com/en-us/library/ms644970(v=vs.85).aspx Local $MSLLHOOKSTRUCT = DllStructCreate($tagMSLLHOOKSTRUCT, $lParam) Local $iRealClick = (DllStructGetData($MSLLHOOKSTRUCT, 'flags') = 0) ;The Click is real, not injected(or simulated) Local $iClickOnClient = _IsCLickOnClient($hWnd, DllStructGetData($MSLLHOOKSTRUCT, 1), DllStructGetData($MSLLHOOKSTRUCT, 2)); Clicked at Client-Area ;Block if the event is real and on the client area only If $iRealClick And $iClickOnClient Then ; ;This would only work for buttons $iControlID = _WinAPI_GetDlgCtrlID($hActive) $iWParam = _WinAPI_MakeLong($iControlID, $BN_CLICKED) _SendMessage($hParent, $WM_COMMAND, $iWParam, $hActive) Return 1 ;Block the Main Click EndIf EndIf Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam) EndFunc ;==>LowLevelMouseProc Func _IsCLickOnClient($hWnd, $iX, $iY) $tRect = _WinAPI_GetClientRect($hWnd) $tPoint = DllStructCreate($tagPoint) DllStructSetData($tPoint, 1, 0) DllStructSetData($tPoint, 2, 0) _WinAPI_ClientToScreen($hWnd, $tPoint) DllStructSetData($tRect, 1, DllStructGetData($tPoint, 1)) DllStructSetData($tRect, 2, DllStructGetData($tPoint, 2)) DllStructSetData($tRect, 3, DllStructGetData($tPoint, 1) + DllStructGetData($tRect, 3)) DllStructSetData($tRect, 4, DllStructGetData($tPoint, 2) + DllStructGetData($tRect, 4)) DllStructSetData($tPoint, 1, $iX) DllStructSetData($tPoint, 2, $iY) Return _WinAPI_PtInRect($tRect, $tPoint) EndFunc ;==>_IsCLickOnClient Func Cleanup() _WinAPI_UnhookWindowsHookEx($hMouseHook) DllCallbackFree($hMouseProc) EndFunc ;==>Cleanup Func Terminate() Exit EndFunc ;==>TerminateYou can even try with Global Const $WS_EX_NOACTIVATE = 0x08000000 With list controls I had no luck. It may help you Regards1 point
-
@condoman - I know this is not what you asked, but I suggest you look at a more efficient and safer way to back up you files, using md5 etc. In fact, there are many good backup programs out there, that will do all you want .... many of them free. If you want something that is quick and simple, then I recommend TeraCopy big time. I move/copy a lot of big files around often, and it gives me peace of mind. Integrates with Explorer to make it even more seamless. I only have it partially integrated and use it via right-click drag and drop. Has to the most brilliant third party program I've ever come across to use with Windows. It comes in two flavors - Free (which I happily use) and Paid (Pro version) which most don't need.1 point