Leaderboard
Popular Content
Showing content with the highest reputation on 07/10/2017 in all areas
-
Rotate animation
Parsix reacted to haijie1223 for a topic
#NoTrayIcon #RequireAdmin #My QQ No: 29535065 #QQ group: 477266297 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $iSleepTime = 80 Global $hGUI = GUICreate("GDI+旋转动画", 400, 280) Global $Pic_Animation = GUICtrlCreatePic('', 5, 5, 256, 256) Global $Btn_Type1 = GUICtrlCreateButton('旋转方式一', 275, 35, 100, 30) Global $Btn_Type2 = GUICtrlCreateButton('旋转方式二', 275, 85, 100, 30) Global $Btn_Type3 = GUICtrlCreateButton('旋转方式三', 275, 135, 100, 30) Global $Slider_Time = GUICtrlCreateSlider(275, 185, 100, 45) GUICtrlSetLimit($Slider_Time, 500, 50) GUISetState() GUISetIcon('shell32.dll',322,$hGUI) GUISetOnEvent(-3, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type1, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type2, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type3, '_GuiEvent') GUICtrlSetOnEvent($Slider_Time, '_GuiEvent') _AnimationInit(ControlGetHandle($hGUI, '', $Pic_Animation), 1) _GDIPlus_Startup() ; While 1 Sleep($iSleepTime) _NextFlash() WEnd Func _GuiEvent() Switch @GUI_CtrlId Case -3 _DeleteCache() Exit Case $Btn_Type1 _ResetAniType(1, 2) Case $Btn_Type2 _ResetAniType(2, 0) Case $Btn_Type3 _ResetAniType(3, 0) Case $Slider_Time $iSleepTime=GUICtrlRead($Slider_Time) EndSwitch EndFunc ;==>_GuiEvent Func _AnimationInit($hHwd, $SpaceSec) Global $m_hWnd = $hHwd Global $m_nWidth, $m_nHeight Global $m_AnimationIndex = 0, $m_AnimationType = 0, $m_AnimationCount = 12 Global $m_ItemSize, $m_MarginAngle Global $m_hCacheDC, $m_hCacheBitmap, $m_hCacheOldBitmap Global $m_Rect = DllStructCreate($tagRECT) Global $m_ColorBack = _WinAPI_GetSysColor($COLOR_BTNFACE) Global $m_ColorBasic[2] = [0x808080, 0xC0C0C0] Global $m_ColorFore1 = [0x1FF4FB, 0x07F98C, 0x91A804, 0xCC9302, 0xAF5801, 0x9C426B, 0x9744A7, 0x9841E4, 0x241BEE, 0x2472F5, 0x2190F4, 0x12C2FF] Global $m_ColorFore2 = [0x34F5FF, 0x3CFDA3, 0xA5B833, 0xD8A733, 0xB67636, 0xAD6988, 0xAD68B9, 0xAC66E9, 0x514AEF, 0x4E8DF5, 0x4BA5FA, 0x3ECEFE] Global $m_AnimationArray[$m_AnimationCount] Local $i For $i = 0 To $m_AnimationCount - 1 $m_AnimationArray[$i] = _AnimationItem() DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next _Resize() _ResetAniType($m_AnimationType, $SpaceSec) EndFunc ;==>_AnimationInit Func _RGB2ARGB($RGBColor, $Alpha) Return BitOR(Binary('0x' & Hex($RGBColor, 6)), BitShift($Alpha, -24)) EndFunc ;==>_RGB2ARGB Func _Resize() _DeleteCache() Local $rc = _WinAPI_GetClientRect($m_hWnd) $m_nWidth = DllStructGetData($rc, 3) - DllStructGetData($rc, 1) $m_nHeight = DllStructGetData($rc, 4) - DllStructGetData($rc, 2) If $m_nWidth > $m_nHeight Then DllStructSetData($m_Rect, 3, ($m_nHeight - 10)) Else DllStructSetData($m_Rect, 3, ($m_nWidth - 10)) EndIf ;~ DllStructSetData($m_Rect, 3, ($m_nWidth > $m_nHeight) ? ($m_nHeight - 10) : ($m_nWidth - 10)) DllStructSetData($m_Rect, 4, DllStructGetData($m_Rect, 3)) DllStructSetData($m_Rect, 1, ($m_nWidth - DllStructGetData($m_Rect, 3)) / 2) DllStructSetData($m_Rect, 2, ($m_nHeight - DllStructGetData($m_Rect, 4)) / 2) $m_ItemSize = 20 EndFunc ;==>_Resize Func _ResetAniType($AniType, $SpaceSec = 0) Local $i $m_AnimationIndex = 0 Switch $AniType Case 0 $m_AnimationType = 0 Case 1 $m_AnimationType = 1 Case 2 $m_AnimationType = 2 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case 3 $m_AnimationType = 3 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case Else _ResetAniType(0) Return EndSwitch $m_MarginAngle = $SpaceSec If $m_MarginAngle > 10 Then $m_MarginAngle = 10 If $m_MarginAngle < 0 Then $m_MarginAngle = 0 EndFunc ;==>_ResetAniType Func _NextFlash() Local $i Switch $m_AnimationType Case 0 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 1 $m_AnimationIndex = 0 EndIf Case 1 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 0 $m_AnimationIndex = 0 EndIf Case 2 local $item=$m_AnimationArray[11] For $i = 0 To $m_AnimationCount - 2 $m_AnimationArray[$m_AnimationCount - $i - 1] = $m_AnimationArray[$m_AnimationCount - $i - 2] Next $m_AnimationArray[0] = $item Case 3 $m_AnimationIndex = $m_AnimationIndex + 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationIndex = 0 EndSwitch _Draw() EndFunc ;==>_NextFlash Func _Draw() Local $hDC = _WinAPI_GetDC($m_hWnd) If $m_hCacheDC = 0 Then $m_hCacheDC = _WinAPI_CreateCompatibleDC($hDC) $m_hCacheBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $m_nWidth, $m_nHeight) $m_hCacheOldBitmap = _WinAPI_SelectObject($m_hCacheDC, $m_hCacheBitmap) EndIf _FillSolidRect($m_hCacheDC, _CRect(0, 0, $m_nWidth, $m_nHeight), $m_ColorBack) _DrawPie($m_hCacheDC) _WinAPI_BitBlt($hDC, 0, 0, $m_nWidth, $m_nHeight, $m_hCacheDC, 0, 0, 0x00CC0020) _WinAPI_ReleaseDC($m_hWnd, $hDC) EndFunc ;==>_Draw Func _CRect($Left, $Top, $Right, $Bottom) Local $Rect = DllStructCreate($tagRECT) DllStructSetData($Rect, 1, $Left) DllStructSetData($Rect, 2, $Top) DllStructSetData($Rect, 3, $Right) DllStructSetData($Rect, 4, $Bottom) Return $Rect EndFunc ;==>_CRect Func _FillSolidRect($hDC, $lpRect, $clr) _WinAPI_SetBkColor($hDC, $clr) _ExtTextOut($hDC, 0, 0, 2, $lpRect, Chr(0), 0, 0) EndFunc ;==>_FillSolidRect Func _DrawPie($hDC) Local $i Local $nStartAngle Local $nSweepAngle Local $pGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsSetSmoothingMode($pGraphics, 4) Local $pBrush = _GDIPlus_BrushCreateSolid(_RGB2ARGB(0, 255)) Local $rcOut = DllStructCreate($tagRECT) DllStructSetData($rcOut, 1, DllStructGetData($m_Rect, 1)) DllStructSetData($rcOut, 2, DllStructGetData($m_Rect, 2)) DllStructSetData($rcOut, 3, DllStructGetData($m_Rect, 3)) DllStructSetData($rcOut, 4, DllStructGetData($m_Rect, 4)) Local $rcIn = DllStructCreate($tagRECT) DllStructSetData($rcIn, 1, DllStructGetData($rcOut, 1)) DllStructSetData($rcIn, 2, DllStructGetData($rcOut, 2)) DllStructSetData($rcIn, 3, DllStructGetData($rcOut, 3)) DllStructSetData($rcIn, 4, DllStructGetData($rcOut, 4)) _InflateRectF($rcIn, -1 * $m_ItemSize) $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 1)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 2)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next If ($m_AnimationType = 3) Then If $m_AnimationIndex > 0 Then $nStartAngle = -90 $nStartAngle = $nStartAngle + $m_AnimationIndex * $nSweepAngle _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB(0xFFFFFF, 150)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) EndIf EndIf _InflateRectF($rcIn, -1 * $m_ItemSize) _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB($m_ColorBack, 255)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), 0, 360, $pBrush) _GDIPlus_BrushDispose($pBrush) _GDIPlus_GraphicsDispose($pGraphics) EndFunc ;==>_DrawPie Func _InflateRectF($rc, $dx, $dy = 0) If $dy = 0 Then $dy = $dx DllStructSetData($rc, 1, DllStructGetData($rc, 1) - $dx) DllStructSetData($rc, 2, DllStructGetData($rc, 2) - $dy) DllStructSetData($rc, 3, DllStructGetData($rc, 3) + $dx * 2) DllStructSetData($rc, 4, DllStructGetData($rc, 4) + $dy * 2) EndFunc ;==>_InflateRectF Func _DeleteCache() If $m_hCacheDC <> 0 Then _WinAPI_SelectObject($m_hCacheDC, $m_hCacheOldBitmap) _WinAPI_DeleteObject($m_hCacheBitmap) _WinAPI_DeleteDC($m_hCacheDC) _GDIPlus_Shutdown() $m_hCacheDC = 0 $m_hCacheBitmap = 0 $m_hCacheOldBitmap = 0 EndIf EndFunc ;==>_DeleteCache Func _ExtTextOut($hDC, $x, $y, $wOptions, $lpRect, $lpString, $nCount, $lpDx) If Not IsPtr($lpRect) Then $lpRect=DllStructGetPtr($lpRect) Local $Ret = DllCall('GDI32.dll', 'BOOL', 'ExtTextOutW', 'HANDLE', $hDC, 'INT', $x, 'INT', $y, 'UINT', $wOptions, 'PTR', $lpRect, 'WSTR', $lpString, 'UINT', $nCount, 'INT', $lpDx) If @error Then Return SetError(@error, 0, 0) Return $Ret[0] EndFunc ;==>_ExtTextOut Func _AnimationItem() Return DllStructCreate('INT;INT;') EndFunc ;==>_AnimationItem1 point -
(firefox - ff.au3) Alternative methods for data input?
Danp2 reacted to Laurynelis for a topic
Everything is perfecto now!1 point -
(firefox - ff.au3) Alternative methods for data input?
Laurynelis reacted to Danp2 for a topic
Actually, the last revision does work with a period. Try it out and let me know if you encounter any issues.1 point -
Problems with free upgrade from Windows 8 to 8.1
Earthshine reacted to MattHiggs for a topic
Well, as far as the laptop being returned, it can't be helped. But Windows 10 being installed on the device is not an issue. If the device originally had Windows 8 or greater installed on it, then its product key is embedded in the BIOS, and a valid Windows 7 or 8 product key will also activate Windows 10 (free upgrade period). What this script does (I had to use it to activate Windows 10 for a deployment project that I was working on for a client and works like a charm) is query the embedded product key from the BIOS using Wmi, then it will take the product key, install it, then activate Windows with it. You may not remember, but during the Windows 10 installation, you were not given an option to select which version of Windows 10 you wanted to install (Home or Pro), right? That was because the installer looked at the product key embedded in the bios, and installed the version of Windows 10 that matched the version of Windows 8 associated with the embedded key.1 point -
Not so easy. After 21:00 (9:00 PM) if 3 hours are added then the day changes... and so on #include <Date.au3> ; first: add 3 hours to current date/time and split the result Local $d, $t _DateTimeSplit(_DateAdd("h", 3, _NowCalc()), $d, $t) ; second: format as needed and put the am/pm thing $time = $d[3] & "/" & $d[2] & "/" & $d[1] & " " & _ StringFormat("%02d:%02d:%02d", Mod($t[1], 12), $t[2], $t[3]) & " " & _ (Floor($t[1]/12) = 0 ? "AM" : "PM") Msgbox(0,"", $time)1 point
-
Using regex to check the format of a string
anthonyjr2 reacted to jchd for a topic
Make that stringregexp($str , "^[A-Z]{2}[0-9]{5}[A-Z]$") if you want to insure there is nothing before nor after the mandatory pattern.1 point -
Using regex to check the format of a string
anthonyjr2 reacted to iamtheky for a topic
$str = "AB12345C" msgbox(0, '' , stringregexp($str , "[A-Z]{2}[0-9]{5}[A-Z]")) *If that is the entirety of the string you may want to put beginning/ending anchors on that pattern so that it does not match on partials.1 point -
First get help samples to work and understand what all functions can and cannot do https://www.autoitscript.com/autoit3/docs/functions/TCPSend.htm1 point
-
Okay Can you do create macro in AutoIt and map to a standard KNOWN KEY? Like ALT+A for instance? I am sure once you understand the mechanism, then extrapolating from there will be easy. Bear in mind that those "custom keys" might just be "macros" for standard key combinations. Remember that keyboard must plug into standard hardware. So they must be able to process those keys in a away that standardized hardware will understand. What I mean is that your keyboards custom key "Custom 1" might simply be macro for a standard key combo, such as "Alt+A" . Press keyboard button "Custom 1" -> keyboard converts to "Alt+A" and send to processor... In addition, AutoIt is not designed, nor intended as a hardware management / accelerator tool, so no surprises there. Good luck.1 point
-
(firefox - ff.au3) Alternative methods for data input?
Laurynelis reacted to Danp2 for a topic
Definitely don't give up! I was just pointing out that sometimes you have to jump through some hoops to get the automation working on some sites. Here's an example --1 point -
Hello Islarama and welcome Imho trying to bypass this error is a mistake. This message is there to tell you that something's wrong with Itunes. You should try to fix it before anything else. A fast search on google suggest this error can be linked to Norton antivirus or another software called "peerblock". Do you have any of these software installed on your computer? https://discussions.apple.com/thread/3814421?tstart=0 If you really want to bypass it, you can try this out: While 1 If WinExists("Itunes", "There was a temporary problem") Then WinKill ("Itunes", "There was a temporary problem") Sleep (100) WEnd PS: I don't want any money1 point
-
That happends because AutoIt include the nice parameter type wstr and str that allow you to wrap all structutures stuffs just using wstr,str. why? this simply happeds because AutoIt does no support string Pointer directry as many other programing lenguages. But you here is an example of using structures in common dllcalls. Local $sFilePath="notepad.exe" Local $tFilePath=DllStructCreate("WCHAR Data[" & StringLen($sFilePath) & "]") $tFilePath.Data=$sFilePath Local $pFilePath=DllStructGetPtr($tFilePath,1) ;this is the prefered correct way DllCall('shell32.dll', 'ULONG_PTR', 'ShellExecuteW', 'hwnd', 0, "wstr", Null, 'wstr', $sFilePath, _ "wstr", Null, "wstr", Null, 'int', 10) ;this is also correct (but please use wstr/str instead) ;~ DllCall('shell32.dll', 'ULONG_PTR', 'ShellExecuteW', 'hwnd', 0, "wstr", Null, 'ptr', $pFilePath, _ ;~ "wstr", Null, "wstr", Null, 'int', 10) ;even this can be correct (but please use wstr/str instead) ;~ DllCall('shell32.dll', 'ULONG_PTR', 'ShellExecuteW', 'hwnd', 0, "wstr", Null, 'struct*', $tFilePath, _ ;~ "wstr", Null, "wstr", Null, 'int', 10) You also can used Null without change the parameter type to ptr and pass value 0. "wstr",Null Null was created for that. Saludos1 point
-
Introductory learn to program text using Au3
Jfish reacted to dilligence for a topic
Thank you Jayme! I am a Dragon NaturallySpeaking ( speech recognition) user. I find that the AutoIT program language has similarities with Dragon scripting (VBA). Like many others I browsed the web for more information about this program language. Having no mathematical background whatsoever, not much programming experience too. Things like variables, constants, dim etc. never seemed to make much sense ( although I read about it in various scripts), now finally start making sense. You've managed to make these things accessible. That's an accomplishment! Rob.1 point -
Removes file stderr.txt (to delete contents each run) Populates a stderr.txt file with output. #include <fstream> int main(int argc, char *argv[]) { // Blank out the file by removing it remove("stderr.txt"); // Open stream to file for appending data FILE *file = fopen("stderr.txt", "a"); for(int counter = 0; counter < 10000; counter++){ // Percent d %d b/c counter is decimal number fprintf(file, "%d: Hello World\n", counter); } ; Close the file stream fclose(file); return 0; } // END main(int argc, char *argv[]) I see timing isn't important in the code. You're not doing it there so I ignored a timer. It is SO fast.1 point
-
10 bucks a line, I haven't heard prices like that since college.1 point
-
Any chance there will be a 64 bit version at some point?1 point