Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/21/2013 in all areas

  1. You have to add a space so TCC can "see" multiple parameters: RunWait('./includes/tc/tcc.exe bckmove.bat ' & $driveletter & ' ' & $dataloc, '', @SW_HIDE)
    2 points
  2. Jon

    AutoIt v3.3.9.18 Beta

    File Name: AutoIt v3.3.9.18 Beta File Submitter: Jon File Submitted: 20 Aug 2013 File Category: Beta 3.3.9.18 (20th August, 2013) (Beta) AutoIt: - Fixed #2384: UDPRecv() and TCPRecv() not setting @error correctly in some instances. - Fixed #2367: Sometimes two COM objects wouldn't be classed as equal during comparisons. UDFs: - Added: GDIPlus functions and their respective documentation and example. - Changed: _FileWriteToLine() can read a file with various line endings (not recommended). - Changed: Re-wrote _FileReadToArray() to use the native function FileReadToArray() when $iFlag is set to 0. - Removed: Documentation and example for _StringReverse(). Scripts should be updated to use the native function StringReverse() instead. Click here to download this file
    1 point
  3. gil900, WMI can monitor starting/ending processes and list the parent process like this ;~ #include <date.au3> ;~ #include <misc.au3> HotKeySet("{ESC}","ESC") local $oerror = ObjEvent("AutoIt.Error", "_DeBug") Local $Obj = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2") Local $hObj = ObjCreate("WbemScripting.SWbemSink") If IsObj($Obj) And IsObj($hObj) Then ObjEvent($hObj, "SINK_") $Obj.ExecNotificationQueryAsync($hObj, "SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process'") $Obj.ExecNotificationQueryAsync($hObj, "SELECT * FROM __InstanceDeletionEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process'") EndIf Sleep(9999999999) Func SINK_OnObjectReady($OB) local $str,$owner,$ret Switch $OB.Path_.Class Case "__InstanceCreationEvent" $str = stringformat('%-10s PID[%05i] Name[%20s] Parent[%5i]', _ '! Started',$OB.TargetInstance.ProcessID,$ob.targetinstance.name,$ob.targetinstance.parentprocessid) consolewrite($str & @lf) $str = "" Case "__InstanceDeletionEvent" $str = stringformat('%-10s PID[%05i] Name[%20s]', _ '! Ended ',$OB.TargetInstance.ProcessID,$ob.targetinstance.name) consolewrite($str & @lf) $str = "" EndSwitch Return 1 EndFunc Func _Debug($oError) ConsoleWrite( _ "! ##################### AUTOIT OBJECT ERROR ######################################" & @CRLF & _ "! err.number is : " & @TAB & hex($oError.number,8) & @CRLF & _ "! err.scriptline is : " & @TAB & $oError.scriptline & @CRLF & _ "! err.windesc is : " & @TAB & $oError.windescription & @CRLF & _ "! err.desc is : " & @TAB & $oError.description & @CRLF & _ "! err.source is : " & @TAB & $oError.source & @CRLF & _ "! err.retcode is : " & @TAB & hex($oError.retcode,8) & @CRLF & _ "! ################################################################################" & @CRLF _ ) Return 0 EndFunc Func ESC() Exit(0) EndFunc Hope it helps! kylomas
    1 point
  4. For the first question. if $nMsg = $Pichm Then For $I = 5 to 9 GUICtrlSetState($I, $GUI_HIDE) Next Endif For your second question, please explain what you mean by clear all objects in a GUI?
    1 point
  5. Look at GUICtrlRead, you're doing it wrong.
    1 point
  6. UEZ

    tooltip info

    Here an example (proof of concept) using GDI+ to create a tooltip arrow position at the bottom. ;coded by UEZ build 2013-08-21 #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> If @AutoItVersion < "3.3.9.18" Then Exit MsgBox(16, "Error", "AutoIt version 3.3.9.18 or higher needed!") _GDIPlus_Startup() Global Const $STM_SETIMAGE = 0x0172 Global $iW = 400, $iH = 25, $iBGColor = 0xFFFFFF Global Const $hGUI = GUICreate("Strip Progressbar", 600, 100, -1, -1, Default, $WS_EX_TOPMOST) GUISetBkColor(0x404040) Global Const $iPic = GUICtrlCreatePic("", 150, 37, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) Global $iBtn = GUICtrlCreateButton("Start", 40, 20, 60, 60) GUISetState() Global $hB, $iSleep = 30 Global $fPerc, $fPercPrev, $iLoop, $aPos, $iPosX, $iPosY Global $aColors[7][2] = [[0xFFEE5F5B, 0xFFF07673],[0xFFABCC04, 0xFFBBD636],[0xFF78CCEE, 0xFF93D6F1],[0xFFFFBB58, 0xFFFFC97A],[0xFFFF6677, 0xFFFF8795],[0xFF78CCEE, 0xFFFFC97A],[0xFF78CCEE, 0xFFE8E5D9]] Global $iRandom, $iColorTP, $hTooltip Global $hImage = _GDIPlus_ImageLoadFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif") Global $aTooltip = _Init(100, 50) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_TIMER, "") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Exit Case $iBtn $fPerc = 0 $iRandom = Random(0, UBound($aColors) - 1, 1) $iColorTP = $aColors[$iRandom][1] _WinAPI_SetLayeredWindowAttributes($aTooltip[0], $aTooltip[6], 255) GUIRegisterMsg($WM_TIMER, "PlayAnim") DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iSleep, "int", 0) EndSwitch Until False Func _Init($iWidth = 70, $iHeight = 50, $iBGTColor = 0xFEDCBA) $hHBmp_BG = _GDIPlus_StripProgressbar(0, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[$iRandom][0], $aColors[$iRandom][1], "") $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($hHBmp_BG) Local $hGUI_ToolTip = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP + $WS_DISABLED, $WS_EX_LAYERED + $WS_EX_TOOLWINDOW, $hGUI) GUISetBkColor($iBGTColor, $hGUI_ToolTip) ;set GUI background color Local $iPic = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight) GUISetState(@SW_HIDE, $hGUI_ToolTip) _WinAPI_SetLayeredWindowAttributes($hGUI_ToolTip, $iBGTColor, 0xFF) Local $aResult[7] = [$hGUI_ToolTip, $iPic, $iWidth, $iHeight, _WinAPI_GetSystemMetrics(7), _WinAPI_GetSystemMetrics(4) + _WinAPI_GetSystemMetrics(33), $iBGTColor] Return $aResult EndFunc ;==>_Init Func PlayAnim() Local $sText = "Loading...", $i, $iCalc1, $iCalc2, $hHBmp_TP $fPerc += 0.25 If $fPerc >= 100.5 Then GUIRegisterMsg($WM_TIMER, "") $sText = "Done" EndIf $iLoop = $fPerc - $fPercPrev $fPercPrev = $fPerc For $i = $iLoop To 0 Step - 1 $iCalc1 = ($fPerc - $i) $hHBmp_BG = _GDIPlus_StripProgressbar($iCalc1, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[$iRandom][0], $aColors[$iRandom][1], $sText) $hB = GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_BG) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($hHBmp_BG) $aPosCtrl = ControlGetPos($hGUI, 0, $iPic) $aPosGUI = WinGetPos($hGUI) $iPosX = $aPosCtrl[0] + $aPosGUI[0] + $aTooltip[4] - $aTooltip[2] / 2 $iPosY = $aPosCtrl[1] + $aPosGUI[1] - $aPosCtrl[3] - 2 If $iCalc1 >= 100.5 Then $iCalc1 = 100 $iCalc2 = $iPosX + ($fPerc - $i) / 100 * $iW - 1 If $iCalc2 >= $iPosX + $iW Then $iCalc2 = $iPosX + $iW $hHBmp_TP = _GDIPlus_CreateToolTipBitmap(StringFormat("%02d%", $iCalc1), $aTooltip[2], $aTooltip[3], "Arial", 11, 0xFFFFFFFF, 0xFF000000, 12, $hImage, 8, 6, 20, 22) _WinAPI_DeleteObject(GUICtrlSendMsg($aTooltip[1], $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp_TP)) _WinAPI_DeleteObject($hHBmp_TP) If WinGetState($aTooltip[0]) <> 3 Then WinSetState($aTooltip[0], "", @SW_SHOWNA) WinMove($aTooltip[0], "", $iCalc2, $iPosY) Next If $fPerc >= 100.5 Then For $i = 255 To 0 Step - 2 _WinAPI_SetLayeredWindowAttributes($aTooltip[0], $aTooltip[6], $i) Sleep(10) Next WinSetState($aTooltip[0], "", @SW_HIDE) EndIf EndFunc ;==>PlayAnim Func _GDIPlus_CreateToolTipBitmap($sText, $iW = 70, $iH = 50, $sFont = "Arial", $fFontSize = 11, $iBGColor = 0xFFFFFFFF, $iFontColor = 0xFF000000, $iRadius = 8, $hImage = 0, $iImgPosX = 8, $iImgPosY = 4, $iImgW = 16, $iImgH = 16, $bGDIBmp = 1) Local $iX = 0, $iY = 0, $iPenSize = 1, $iSize = 12, $iSize2 = $iSize / 2, $iDX = $iW / 2 Local $iWidth = $iW - $iPenSize, $iHeight = $iH - $iPenSize - $iSize Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY, $iRadius * 2, $iRadius * 2, 270, 90) _GDIPlus_PathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) _GDIPlus_PathAddLine($hPath, $iX + $iWidth - ($iRadius * 2), $iY + $iHeight, $iDX + $iSize2, $iY + $iHeight) _GDIPlus_PathAddLine($hPath, $iDX + $iSize2, $iY + $iHeight, $iX + $iDX, $iY + $iHeight + $iSize) _GDIPlus_PathAddLine($hPath, $iX + $iDX, $iY + $iHeight + $iSize, $iX + $iDX - $iSize2, $iY + $iHeight) _GDIPlus_PathAddArc($hPath, $iX, $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) _GDIPlus_PathAddArc($hPath, $iX, $iY, $iRadius * 2, $iRadius * 2, 180, 90) _GDIPlus_PathCloseFigure($hPath) Local $hBrush = _GDIPlus_BrushCreateSolid($iBGColor) _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush) Local $hPen = _GDIPlus_PenCreate(0xFF000000, $iPenSize) _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) Local $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize) Local $hFormat = _GDIPlus_StringFormatCreate() Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iWidth, $iHeight) _GDIPlus_StringFormatSetAlign($hFormat, 1) Local $aMeasure = _GDIPlus_GraphicsMeasureString($hCtxt, $sText, $hFont, $tLayout, $hFormat) DllStructSetData($tLayout, "Y", ($iHeight - DllStructGetData($aMeasure[0], "Height")) / 2) _GDIPlus_BrushSetSolidColor($hBrush, $iFontColor) _GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush) If $hImage Then _GDIPlus_GraphicsSetInterpolationMode($hCtxt, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsDrawImageRectRect($hCtxt, $hImage, 0, 0, _GDIPlus_ImageGetWidth($hImage), _GDIPlus_ImageGetHeight($hImage), $iImgPosX, $iImgPosY, $iImgW, $iImgH) EndIf _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_PathDispose($hPath) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCtxt) If $bGDIBmp Then Local $hGDIBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hGDIBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_CreateToolTipBitmap Func _GDIPlus_StripProgressbar($fPerc, $iW, $iH, $iBgColorGui = 0xFFF0F0F0, $iFgColor = 0xFFEE5F5B, $iBGColor = 0xFFF07673, $sText = "Loading...", $iTextColor = 0x000000, $iDir = -1, $iSpeed = 1, $sFont = "Arial", $bFlip = False, $bHBitmap = True) If $fPerc < 0 Then $fPerc = 0 If $fPerc > 100 Then $fPerc = 100 Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0) $hBitmap = $hBitmap[6] Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsClear($hCtxt, $iBgColorGui) Local $iWidth = $iH * 2, $iLen = $iWidth / 2, $iY Local $hBmp = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iH, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0) $hBmp = $hBmp[6] Local Const $hCtxt_Bmp = _GDIPlus_ImageGetGraphicsContext($hBmp) Local $hPen = _GDIPlus_PenCreate($iFgColor), $iPenSize = Int($iH / 12) Local $hPen2 = _GDIPlus_PenCreate(0x50000000, $iPenSize) _GDIPlus_GraphicsClear($hCtxt_Bmp, $iBGColor) Local Static $iX = 0 For $iY = 0 To $iH - 1 Switch $iDir Case 1 _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY, $iY, $iX + $iY + $iLen, $iY, $hPen) _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY - 2 * $iLen, $iY, $iX + $iY - 1 * $iLen, $iY, $hPen) Case Else _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY, $iY, -$iX + $iY + $iLen, $iY, $hPen) _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY + 2 * $iLen, $iY, -$iX + $iY + 3 * $iLen, $iY, $hPen) EndSwitch Next Local $tPoint1 = DllStructCreate("float;float") Local $tPoint2 = DllStructCreate("float;float") DllStructSetData($tPoint1, 1, $iW / 2) ;x1 DllStructSetData($tPoint2, 1, $iW / 2) ;x2 Local $hLineBrush If $bFlip Then _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, 0, $iWidth, 0, $hPen2) DllStructSetData($tPoint1, 2, $iH / 3) ;y1 DllStructSetData($tPoint2, 2, $iH * 2 / 3) ;y2 $hLineBrush = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0x00FFFFFF, "uint", 0xB0FFFFFF, "int", 0, "int*", 0) $hLineBrush = $hLineBrush[6] _GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, $iH * 2 / 3 + 1, $iW, $iH / 3, $hLineBrush) Else _GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, $iH - $iPenSize / 2, $iWidth, $iH - $iPenSize / 2, $hPen2) DllStructSetData($tPoint1, 2, 0) ;y1 DllStructSetData($tPoint2, 2, $iH / 3) ;y2 $hLineBrush = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0xB0FFFFFF, "uint", 0x00FFFFFF, "int", 0, "int*", 0) $hLineBrush = $hLineBrush[6] _GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, 0, $iW, $iH / 3, $hLineBrush) EndIf $iX = Mod($iX + $iSpeed, $iWidth) Local $hTextureBrush = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "handle", $hBmp, "int", 0, "int*", 0) $hTextureBrush = $hTextureBrush[3] _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $fPerc / 100 * $iW, $iH, $hTextureBrush) If $bFlip Then DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 6) DllCall($ghGDIPDll, "int", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", $GDIP_TEXTRENDERINGHINT_CLEARTYPEGRIDFIT) Local $hBrush = _GDIPlus_BrushCreateSolid(0x40000000 + $iTextColor) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $hFont = _GDIPlus_FontCreate($hFamily, $iH * 3 / 5, 2) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_GraphicsDispose($hCtxt_Bmp) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_BrushDispose($hTextureBrush) _GDIPlus_BrushDispose($hLineBrush) If $bHBitmap Then Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBITMAP EndIf Return $hBitmap EndFunc ;==>_GDIPlus_StripProgressbar Br, UEZ
    1 point
  7. dragan

    InetRead

    how about this: Local $webURL = 'http://www.autoitscript.com/site' Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET",$webURL) $oHTTP.Send() $oHTTP.WaitForResponse() Local $HTMLSource = $oHTTP.Responsetext ConsoleWrite($HTMLSource & @CRLF) $oHTTP = 0
    1 point
  8. Unc3nZureD

    Suspend a process

    Good Luck: http://bit.ly/14inns4
    1 point
  9. Simple answer, you cannot. You use Multiprocessing or move along.
    1 point
  10. crashdemons

    [Game] StarShooter

    I had this FINISHED, lying around, waiting to be released here but I never got around to it. Now, here it is. Note 1: this is NOT using any images - it is only drawing-based! The sounds for this particular project were shamelessly ripped from elsewhere. Please let me know if it is too hard or too easy - more things can be added/changed! StarShooter.zip Known Bugs: Enemy phaser lines sometimes rarely draw towards 0,0 instead of towards you. Fixed If you go off-screen [wrapped] too many times or fly straight for too long, enemies clump/merge together on top of each other.
    1 point
×
×
  • Create New...