Jump to content

DjDeep00

Active Members
  • Posts

    636
  • Joined

  • Last visited

Everything posted by DjDeep00

  1. @Valery...Did you run the code that I posted? I am having problems with the following area of the code: $aChartValue[0] = 0 $aChartValue[1] = 0 $aChartValue[2] = 0 $aChartValue[3] = 0 $aChartValue[4] = 100 Thanks.
  2. WideBoyDixon can you please help me out with this?
  3. @Valery...I agree and that is exactly what I found out as well, that the error occurs because of the -1 value for $nCount. I think it comes back with a -1 because no other pie piece has been drawn since they are all 0s. I think the following code will need to be updated but not sure how. ; Decide which pieces to draw first and last Local $nStart = -1, $nEnd = -1 For $nCount = 0 To UBound($Percentage) -1 $angleStart = Mod($Angles[$nCount], 360) $angleSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) If $angleStart <= 270 And ($angleStart + $angleSweep) >= 270 Then $nStart = $nCount EndIf If ($angleStart <= 90 And ($angleStart + $angleSweep) >= 90) _ Or ($angleStart <= 450 And ($angleStart + $angleSweep) >= 450) Then $nEnd = $nCount EndIf If $nEnd >= 0 And $nStart >= 0 Then ExitLoop Next Thanks.
  4. Can someone help me resolve the following error? Local $iStart = Mod($Angles[$nCount], 360), $iSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) Local $iStart = Mod($Angles[^ ERROR #include <GDIPlus.au3> #include <WinAPI.au3> #include <GUISlider.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> ; Let's be strict here Opt("MustDeclareVars", 1) ; Controls the size of the pie and also the depth Global Const $PIE_DIAMETER = 400 Global Const $PIE_MARGIN = $PIE_DIAMETER * 0.025 Global Const $PIE_DEPTH = $PIE_DIAMETER * 0.2 Global Const $PIE_AREA = $PIE_DIAMETER + 2 * $PIE_MARGIN ; Random data for values and colours Global Const $NUM_VALUES = 5 Global $aChartValue[$NUM_VALUES] Global $aChartColour[$NUM_VALUES] Global $aChartColour[5] = ["0xFF8204", "0x0000FF", "0xFF0000", "0x008000", "0xEEF3F6"] $aChartValue[0] = 0 $aChartValue[1] = 0 $aChartValue[2] = 0 $aChartValue[3] = 0 $aChartValue[4] = 100 ; The value of PI Global Const $PI = ATan(1) * 4 ; Start GDI+ _GDIPlus_Startup() ; Create the brushes and pens Global $ahBrush[$NUM_VALUES][2], $ahPen[$NUM_VALUES] For $i = 0 To $NUM_VALUES - 1 $ahBrush[$i][0] = _GDIPlus_BrushCreateSolid(BitOR(0xff000000, $aChartColour[$i])) $ahBrush[$i][1] = _GDIPlus_BrushCreateSolid(BitOR(0xff000000, _GetDarkerColour($aChartColour[$i]))) $ahPen[$i] = _GDIPlus_PenCreate(BitOR(0xff000000, _GetDarkerColour(_GetDarkerColour($aChartColour[$i])))) Next ; Create the GUI with sliders to control the aspect, rotation, style and hole size (for donuts) Global $hWnd = GUICreate("Pie Chart", $PIE_AREA, $PIE_AREA + 100, Default, Default) Global $hSlideAspect = _GUICtrlSlider_Create($hWnd, $PIE_MARGIN, $PIE_AREA + 10, $PIE_DIAMETER, 20) _GUICtrlSlider_SetRange($hSlideAspect, 10, 100) _GUICtrlSlider_SetPos($hSlideAspect, 50) Global $hSlideRotation = _GUICtrlSlider_Create($hWnd, $PIE_MARGIN, $PIE_AREA + 40, $PIE_DIAMETER, 20) _GUICtrlSlider_SetRange($hSlideRotation, 0, 360) Global $cStyle = GUICtrlCreateCheckbox("Donut", $PIE_MARGIN, $PIE_AREA + 70, $PIE_DIAMETER / 2 - $PIE_MARGIN, 20) Global $hStyle = GUICtrlGetHandle($cStyle) Global $hHoleSize = _GUICtrlSlider_Create($hWnd, $PIE_MARGIN + $PIE_DIAMETER / 2, $PIE_AREA + 70, $PIE_DIAMETER / 2, 20) _GUICtrlSlider_SetRange($hHoleSize, 2, $PIE_DIAMETER - 4 * $PIE_MARGIN) _GUICtrlSlider_SetPos($hHoleSize, $PIE_DIAMETER / 2) GUISetState() ; Set up GDI+ Global $hDC = _WinAPI_GetDC($hWnd) Global $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($PIE_AREA, $PIE_AREA, $hGraphics) Global $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2) ; Draw the initial pie chart _DrawPie($aChartValue, _GUICtrlSlider_GetPos($hSlideAspect) / 100, _ _GUICtrlSlider_GetPos($hSlideRotation), _ (GUICtrlRead($cStyle) = $GUI_CHECKED), _ _GUICtrlSlider_GetPos($hHoleSize)) ; The sliders will send WM_NOTIFY messages GUIRegisterMsg($WM_NOTIFY, "_OnNotify") ; Wait until the user quits While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd ; Release the resources For $i = 0 To UBound($aChartColour) - 1 _GDIPlus_PenDispose($ahPen[$i]) _GDIPlus_BrushDispose($ahBrush[$i][0]) _GDIPlus_BrushDispose($ahBrush[$i][1]) Next _GDIPlus_GraphicsDispose($hBuffer) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_ReleaseDC($hWnd, $hDC) ; Shut down GDI+ _GDIPlus_Shutdown() ; Done Exit ; Get a darker version of a colour by extracting the RGB components Func _GetDarkerColour($Colour) Local $Red, $Green, $Blue $Red = (BitAND($Colour, 0xff0000) / 0x10000) - 40 $Green = (BitAND($Colour, 0x00ff00) / 0x100) - 40 $Blue = (BitAND($Colour, 0x0000ff)) - 40 If $Red < 0 Then $Red = 0 If $Green < 0 Then $Green = 0 If $Blue < 0 Then $Blue = 0 Return ($Red * 0x10000) + ($Green * 0x100) + $Blue EndFunc ;==>_GetDarkerColour ; Draw the pie chart Func _DrawPie($Percentage, $Aspect, $rotation, $style = 0, $holesize = 100) If $style <> 0 Then $Aspect = 1 Local $nCount, $nTotal = 0, $angleStart, $angleSweep, $X, $Y Local $pieLeft = $PIE_MARGIN, $pieTop = $PIE_AREA / 2 - ($PIE_DIAMETER / 2) * $Aspect Local $pieWidth = $PIE_DIAMETER, $pieHeight = $PIE_DIAMETER * $Aspect, $hPath ; Total up the values For $nCount = 0 To UBound($Percentage) - 1 $nTotal += $Percentage[$nCount] Next ; Set the fractional values For $nCount = 0 To UBound($Percentage) - 1 $Percentage[$nCount] /= $nTotal Next ; Make sure we don't over-rotate $rotation = Mod($rotation, 360) ; Clear the graphics buffer _GDIPlus_GraphicsClear($hBuffer, 0xffc0c0c0) ; Set the initial angles based on the fractional values Local $Angles[UBound($Percentage) + 1] For $nCount = 0 To UBound($Percentage) If $nCount = 0 Then $Angles[$nCount] = $rotation Else $Angles[$nCount] = $Angles[$nCount - 1] + ($Percentage[$nCount - 1] * 360) EndIf Next Switch $style Case 0 ; Adjust the angles based on the aspect For $nCount = 0 To UBound($Percentage) $X = $PIE_DIAMETER * Cos($Angles[$nCount] * $PI / 180) $Y = $PIE_DIAMETER * Sin($Angles[$nCount] * $PI / 180) $Y -= ($PIE_DIAMETER - $pieHeight) * Sin($Angles[$nCount] * $PI / 180) If $X = 0 Then $Angles[$nCount] = 90 + ($Y < 0) * 180 Else $Angles[$nCount] = ATan($Y / $X) * 180 / $PI EndIf If $X < 0 Then $Angles[$nCount] += 180 If $X >= 0 And $Y < 0 Then $Angles[$nCount] += 360 $X = $PIE_DIAMETER * Cos($Angles[$nCount] * $PI / 180) $Y = $pieHeight * Sin($Angles[$nCount] * $PI / 180) Next ; Decide which pieces to draw first and last Local $nStart = -1, $nEnd = -1 For $nCount = 0 To UBound($Percentage) - 1 $angleStart = Mod($Angles[$nCount], 360) $angleSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) If $angleStart <= 270 And ($angleStart + $angleSweep) >= 270 Then $nStart = $nCount EndIf If ($angleStart <= 90 And ($angleStart + $angleSweep) >= 90) _ Or ($angleStart <= 450 And ($angleStart + $angleSweep) >= 450) Then $nEnd = $nCount EndIf If $nEnd >= 0 And $nStart >= 0 Then ExitLoop Next ; Draw the first piece _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nStart, $Angles) ; Draw pieces "to the right" $nCount = Mod($nStart + 1, UBound($Percentage)) While $nCount <> $nEnd _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nCount, $Angles) $nCount = Mod($nCount + 1, UBound($Percentage)) WEnd ; Draw pieces "to the left" $nCount = Mod($nStart + UBound($Percentage) - 1, UBound($Percentage)) While $nCount <> $nEnd _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nCount, $Angles) $nCount = Mod($nCount + UBound($Percentage) - 1, UBound($Percentage)) WEnd ; Draw the last piece _DrawPiePiece($hBuffer, $pieLeft, $pieTop, $pieWidth, $pieHeight, $PIE_DEPTH * (1 - $Aspect), $nEnd, $Angles) Case 1 ; Draw the donut pieces For $nCount = 0 To UBound($Percentage) - 1 $angleStart = Mod($Angles[$nCount], 360) $angleSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) ; Draw the outer arc in a darker colour $hPath = _GDIPlus_GraphicsPathCreate() _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft, $pieTop, $pieWidth, $pieHeight, $angleStart, $angleSweep) _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft + $PIE_MARGIN, $pieTop + $PIE_MARGIN, $pieWidth - $PIE_MARGIN * 2, _ $pieHeight - $PIE_MARGIN * 2, $angleStart + $angleSweep, -$angleSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hBuffer, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hBuffer, $ahPen[$nCount], $hPath) _GDIPlus_GraphicsPathDispose($hPath) ; Draw the inner piece in a lighter colour - leave room for the hole $hPath = _GDIPlus_GraphicsPathCreate() _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft + $PIE_MARGIN, $pieTop + $PIE_MARGIN, $pieWidth - $PIE_MARGIN * 2, _ $pieHeight - $PIE_MARGIN * 2, $angleStart, $angleSweep) _GDIPlus_GraphicsPathAddArc($hPath, $pieLeft + ($PIE_DIAMETER - $holesize) / 2, $pieTop + ($PIE_DIAMETER - $holesize) / 2, _ $holesize, $holesize, $angleStart + $angleSweep, -$angleSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hBuffer, $ahBrush[$nCount][0], $hPath) _GDIPlus_GraphicsDrawPath($hBuffer, $ahPen[$nCount], $hPath) _GDIPlus_GraphicsPathDispose($hPath) Next EndSwitch ; Now draw the bitmap on to the device context of the window _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) EndFunc ;==>_DrawPie Func _OnNotify($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Switch $hWndFrom Case $hSlideAspect, $hSlideRotation, $hStyle, $hHoleSize ; Update the pie chart _DrawPie($aChartValue, _GUICtrlSlider_GetPos($hSlideAspect) / 100, _ _GUICtrlSlider_GetPos($hSlideRotation), _ (GUICtrlRead($cStyle) = $GUI_CHECKED), _ _GUICtrlSlider_GetPos($hHoleSize)) EndSwitch EndFunc ;==>_OnNotify Func _DrawPiePiece($hGraphics, $iX, $iY, $iWidth, $iHeight, $iDepth, $nCount, $Angles) Local $hPath, $cX = $iX + ($iWidth / 2), $cY = $iY + ($iHeight / 2), $fDrawn = False Local $iStart = Mod($Angles[$nCount], 360), $iSweep = Mod($Angles[$nCount + 1] - $Angles[$nCount] + 360, 360) ; Draw side ConsoleWrite(_Now() & @CRLF) $hPath = _GDIPlus_GraphicsPathCreate() If $iStart < 180 And ($iStart + $iSweep > 180) Then _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iWidth, $iHeight, $iStart, 180 - $iStart) _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iDepth, $iWidth, $iHeight, 180, $iStart - 180) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hGraphics, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hGraphics, $ahPen[$nCount], $hPath) $fDrawn = True EndIf If $iStart + $iSweep > 360 Then _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iWidth, $iHeight, 0, $iStart + $iSweep - 360) _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iDepth, $iWidth, $iHeight, $iStart + $iSweep - 360, 360 - $iStart - $iSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hGraphics, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hGraphics, $ahPen[$nCount], $hPath) $fDrawn = True EndIf If $iStart < 180 And (Not $fDrawn) Then _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iWidth, $iHeight, $iStart, $iSweep) _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iDepth, $iWidth, $iHeight, $iStart + $iSweep, -$iSweep) _GDIPlus_GraphicsPathCloseFigure($hPath) _GDIPlus_GraphicsFillPath($hGraphics, $ahBrush[$nCount][1], $hPath) _GDIPlus_GraphicsDrawPath($hGraphics, $ahPen[$nCount], $hPath) EndIf _GDIPlus_GraphicsPathDispose($hPath) ; Draw top _GDIPlus_GraphicsFillPie($hGraphics, $iX, $iY, $iWidth, $iHeight, $iStart, $iSweep, $ahBrush[$nCount][0]) _GDIPlus_GraphicsDrawPie($hGraphics, $iX, $iY, $iWidth, $iHeight, $iStart, $iSweep, $ahPen[$nCount]) EndFunc ;==>_DrawPiePiece Func _GDIPlus_GraphicsPathCreate($iFillMode = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $iFillMode, "int*", 0); If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, $aResult[2]) EndFunc ;==>_GDIPlus_GraphicsPathCreate Func _GDIPlus_GraphicsPathAddLine($hGraphicsPath, $iX1, $iY1, $iX2, $iY2) Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathLine", "hwnd", $hGraphicsPath, "float", $iX1, "float", $iY1, _ "float", $iX2, "float", $iY2) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathAddLine Func _GDIPlus_GraphicsPathAddArc($hGraphicsPath, $iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle) Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathArc", "hwnd", $hGraphicsPath, "float", $iX, "float", $iY, _ "float", $iWidth, "float", $iHeight, "float", $iStartAngle, "float", $iSweepAngle) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathAddArc Func _GDIPlus_GraphicsPathAddPie($hGraphicsPath, $iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle) Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathPie", "hwnd", $hGraphicsPath, "float", $iX, "float", $iY, _ "float", $iWidth, "float", $iHeight, "float", $iStartAngle, "float", $iSweepAngle) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathAddPie Func _GDIPlus_GraphicsPathCloseFigure($hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathCloseFigure Func _GDIPlus_GraphicsPathDispose($hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeletePath", "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsPathDispose Func _GDIPlus_GraphicsDrawPath($hGraphics, $hPen, $hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawPath", "hwnd", $hGraphics, "hwnd", $hPen, "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsDrawPath Func _GDIPlus_GraphicsFillPath($hGraphics, $hBrush, $hGraphicsPath) Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "hwnd", $hGraphics, "hwnd", $hBrush, "hwnd", $hGraphicsPath) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, 0) EndFunc ;==>_GDIPlus_GraphicsFillPath
  5. @randeep... ProgAndy is correct you need to use Guiseticon() like this... #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $msg GUICreate("My GUI new icon") ; will create a dialog box that when displayed is centered GUISetIcon("shell32.dll",-20) ; will change icon GUISetState(); will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example
  6. @E1M1... Remember that when you use any of the advanced controls like _GuiCtrlCreate*, these controls are not standard controls and currently AutoIt does not play nice with them. However you can control these yourself by using WM_NOTIFY() #include <GuiConstantsEx.au3> #include <GuiTab.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("test",200,200) $hTab = _GUICtrlTab_Create($Form1, 0, 0, 640, 120) _GUICtrlTab_InsertItem($hTab, 0 ,"Untitled") $Label1 = GUICtrlCreateLabel ( "text",50,50,75,20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) _GUICtrlTab_InsertItem($hTab, 1 ,"Untitled2") GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndTab, $tNMHDR, $HwndFrom, $iCode $hWndTab = $hTab If Not IsHWnd($hWndTab) Then $hWndTab = GUICtrlGetHandle($hTab) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $HwndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $HwndFrom Case $hWndTab Switch $iCode Case $TCN_SELCHANGE Switch _GUICtrlTab_GetCurSel($hTab) Case 0 GUICtrlSetState($Label1,$GUI_SHOW) Case 1 GUICtrlSetState($Label1,$GUI_HIDE) Case 2; Third tab... Case 3; Fourth tab... EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
  7. @idoru... Find out what the error is like this... Global $g_eventerror = 0 ; to be checked to know if com error occurs. Must be reset after handling. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler Dim $strComputer, $strChassis Dim $objWMIService, $objChassis, $colChassis, $objItem $strComputer = "." $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colChassis = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure","",16) For $objChassis in $colChassis For $objItem in $objChassis.ChassisTypes Select Case $objItem=1 $strChassis = "Maybe Virtual Machine" Case $objItem=2 $strChassis = "??" Case $objItem=3 $strChassis = "Desktop" Case $objItem=4 $strChassis = "Thin Desktop" Case $objItem=5 $strChassis = "Pizza Box" Case $objItem=6 $strChassis = "Mini Tower" Case $objItem=7 $strChassis = "Full Tower" Case $objItem=8 $strChassis = "Portable" Case $objItem=9 $strChassis = "Laptop" Case $objItem=10 $strChassis = "Notebook" Case $objItem=11 $strChassis = "Hand Held" Case $objItem=12 $strChassis = "Docking Station" Case $objItem=13 $strChassis = "All in One" Case $objItem=14 $strChassis = "Sub Notebook" Case $objItem=15 $strChassis = "Space-Saving" Case $objItem=16 $strChassis = "Lunch Box" Case $objItem=17 $strChassis = "Main System Chassis" Case $objItem=18 $strChassis = "Lunch Box" Case $objItem=19 $strChassis = "SubChassis" Case $objItem=20 $strChassis = "Bus Expansion Chassis" Case $objItem=21 $strChassis = "Peripheral Chassis" Case $objItem=22 $strChassis = "Storage Chassis" Case $objItem=23 $strChassis = "Rack Mount Unit" Case $objItem=24 $strChassis = "Sealed-Case PC" EndSelect Next Next MsgBox(0, "Computer chassis type: " , $strChassis) Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(4096 + 16, "ERROR", "A COM Error was intercepted!" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) $g_eventerror = 1; something to check for when this function returns Endfunc
  8. @randeep... #include <Process.au3> $rc = _RunDos("Start Wordpad C:\T-MATRIX\Database\Scripts\Single_Site\Create_empty_database.sql")
  9. 1 & 2 - Look in the helpfile for mousemove functions. 3 - Look in the helpfile for while loop. You need to write some code for us to help you.
  10. Another way... #include <GUIComboBoxEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <File.au3> #NoTrayIcon $Window1 = GUICreate ("Test",300,400) $List = _GUICtrlComboBoxEx_Create ($Window1,"",50,5,180,200) $Directory_Array = _FileListToArray(@WorkingDir) For $x=1 to $Directory_Array[0] If StringInStr($Directory_Array[$x],".") = 0 then _GUICtrlComboBoxEx_InsertString ($List, $Directory_Array[$x]) Next GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd
  11. @Negat1e....You first need to increase the combo box control's height and add a filter in _GUICtrlComboBoxEx_AddDir ($List,@WorkingDir & "\*.exe").
  12. @mdiesel...Yeah dude I got nothing after trying all sorts of GDI functions..I will keep trying never really worked with these before.... How would I fill in a custom color for the graphic?
  13. Was wondering if I could draw this shape instead of using the pic control?
  14. @Thương Tín...Error handler should tell you whats up... Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") Func MyErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($oMyError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $oMyError.WinDescription & @CRLF $strMsg &= "Script Line: " & $oMyError.ScriptLine & @CRLF MsgBox(0, "ERROR", $strMsg) SetError(1) Endfunc Edit: Updated to the correct name.
  15. @TheBobynator... Maybe "Scotty" can help you with the teleporting but if you are looking to move the mouse cursor instantly then look at the speed parameter for the MouseMove function in the help file. MouseMove(10, 100,0) Sleep(1000) MouseMove(700, 700, 0) Sleep(1000) MouseMove(10, 100,0)
  16. @Cecchino94...What do u want to accomplish using "ControlMouseDown" and "ControlMouseMove"? I hope you checked the help file before posting cuz these functions already exist.
  17. Didnt know it was that easy... SELECT REGEXP_SUBSTR('CAPE CORAL FL 33914-6428','[^ ]+', 1, 3) FROM DUAL;
  18. Can anyone help me return only the state from the following using the REGEXP_SUBSTR function in oracle? Data: NEWTON FALLS OHIO 44444-9416 CAPE CORAL FL 33914-6428 This is what I have: SELECT REGEXP_SUBSTR('CAPE CORAL FL 33914-6428', '+ [^-]+ ') FROM DUAL;
  19. @marian001...I would install DebugBar and look in the help file for IE functions.
  20. @bpneiman... You should be able to auto-login to your SSH server by downloading the PuTTYgen from here and following these steps.
  21. No bug...After you set the correct styles the tips should display...See comments below... #include <GUIConstants.au3> #include <StaticConstants.au3> GUICreate("My GUI", 250, 150) $Btn1 = GUICtrlCreateButton("ON", 10, 10, 50) $Btn2 = GUICtrlCreateButton("OFF", 10, 40, 50) GUISetState(@SW_SHOW) $Label = GUICtrlCreateLabel("Test", 70, 45, 53, 15) GUICtrlSetStyle(-1, $SS_GRAYFRAME);--> This is incorrect, as you can see your text "test" disappears. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Btn1 GUICtrlSetStyle($Label, 0);---> This is incorrect, there is no such style. GUICtrlSetBkColor($Label, 0xFFFF00) GUICtrlSetTip($Label, "My TIP") Case $Btn2 GUICtrlSetStyle(-1, $SS_GRAYFRAME);---> Same mistake. EndSwitch WEnd GUIDelete() Did you want this? #include <GUIConstants.au3> #include <StaticConstants.au3> GUICreate("My GUI", 250, 150) $Btn1 = GUICtrlCreateButton("ON", 10, 10, 50) $Btn2 = GUICtrlCreateButton("OFF", 10, 40, 50) GUISetState(@SW_SHOW) $Label = GUICtrlCreateLabel("OFF", 70, 45, 53, 20,-1,$SS_GRAYRECT) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Btn1 GUICtrlSetBkColor($Label, 0xFFFF00) GUICtrlSetData($Label,"ON") GUICtrlSetTip($Label, "My TIP") Case $Btn2 GUICtrlSetBkColor($Label, 0xE0DFE3) GUICtrlSetData($Label,"OFF") GUICtrlSetTip($Label, "") EndSwitch WEnd GUIDelete()
  22. These were my first assumptions, but I wasn't really sure. After tweaking the help file example... #include <SQLite.au3> #include <SQLite.dll.au3> Local $hQuery, $aRow, $aNames _SQLite_Startup() _SQLite_Open(); open :memory: Database _SQLite_Exec(-1, "CREATE TABLE aTest (a,b,c);") _SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") _SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3','Hello');") _SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');") _SQLite_Query(-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery) _SQLite_FetchNames($hQuery, $aNames) ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CR) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK; Read Out the next Row ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CR) Local $sql = "update aTest set a='test' where c='" & $aRow[3] & "'" $err = _SQLite_Exec(-1, $sql) If $SQLITE_OK = $err Then ;MsgBox(4096, "", "Worked") Else MsgBox(4096, "", _SQLite_ErrCode()) EndIf WEnd ConsoleWrite("**********************************************************" & @CRLF) _SQLite_Query(-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery) _SQLite_FetchNames($hQuery, $aNames) ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CR) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK; Read Out the next Row ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CR) WEnd _SQLite_Exec(-1, "DROP TABLE aTest;") _SQLite_Close() _SQLite_Shutdown()
  23. jedliu, Not sure why are you expecting a 0 for failure? Here is how I would do it... $err = _SQLite_Exec(-1, $sql) If $SQLITE_OK = $err Then MsgBox(4096, "", "Worked") Else MsgBox(4096, "", _SQLite_ErrCode()) EndIf
  24. @Xah...Try this... ControlClick("Windows Internet Explorer", "", "[CLASS:Button; TEXT:OK; Instance:1;]")
×
×
  • Create New...