Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/28/2017 in all areas

  1. UEZ

    Colorization Custom Sliders

    Here an example for the 1st slider: ;coded by rover / Yashied / UEZ build 2017-06-28 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <SliderConstants.au3> #include <StructureConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Const $tagNMCUSTOMDRAW = $tagNMHDR & ';dword DrawStage;handle hDC;long Rect[4];dword_ptr ItemSpec;uint ItemState;lparam ItemlParam' Global $hSlider, $hHBitmap, $hHBitmap2, $bmWidth = 8, $bmHeight = 25, $iWidth = 360, $iHeight = 15, $iXPos = 40 Example() Func Example() _GDIPlus_Startup() Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), $hPen = _GDIPlus_PenCreate() _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) Local $h, $RGB For $h = 0 To $iWidth $RGB = HSLToRGB($h / 360, 1, 0.5) _GDIPlus_PenSetColor($hPen, 0xFF000000 + $RGB) _GDIPlus_GraphicsDrawLine($hGfx, $h, 0, $h, $iHeight, $hPen) Next $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_GraphicsDispose($hGfx) Local Const $hBitmap2 = _GDIPlus_BitmapCreateFromScan0($bmWidth, $bmHeight), $hGfx2 = _GDIPlus_ImageGetGraphicsContext($hBitmap), $hBrush = _GDIPlus_BrushCreateSolid() _GDIPlus_GraphicsFillRect($hGfx2, 0, 0, $bmWidth, $bmHeight, $hBrush) $hHBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap2,0xFF404040) ;slider thumb color _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_GraphicsDispose($hGfx2) _GDIPlus_ImageDispose($hBitmap2) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() GUICreate("HSL Slider", 450, 100) GUISetBkColor(0xFFFFFF) GUICtrlCreateLabel("HSL: ", 15, 18, 25, 20) Local $idSlider = GUICtrlCreateSlider($iXPos, 10, $iWidth + 30, 25, BitOR($TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_TABSTOP)) GUICtrlSetLimit(-1, 359, 0) ; change max/min value $hSlider = GUICtrlGetHandle($idSlider) GUICtrlSetCursor(-1, 0) GUICtrlSetBkColor(-1, 0xFFFFFF) _SendMessage($hSlider, $TBM_SETTHUMBLENGTH, 2 * $bmHeight - 1, 0) Local $idButton = GUICtrlCreateButton("RGB Value", 75, 70, 70, 20) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) GUICtrlSetData($idSlider, 0) ; set cursor ; Loop until the user exits. Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() _WinAPI_DeleteObject($hHBitmap) _WinAPI_DeleteObject($hHBitmap2) Exit Case $idButton MsgBox($MB_SYSTEMMODAL, "Slider", "RGB color in hex format: " & Hex(HSLToRGB(GUICtrlRead($idSlider) / 360, 1, 0.5), 6), 10) EndSwitch Until False EndFunc ;==>Example Func HSLToRGB($h, $s, $l) If Not $s Then Return BitShift(0xFF * $l, -16) + BitShift(0xFF * $l, -8) + BitShift(0xFF * $l, 0) Local Const $q = $l < 0.5 ? $l * (1 + $s) : $l + $s - $l * $s Local Const $p = 2 * $l - $q Return BitShift(0xFF * HUEtoRGB($p, $q, $h - 0.33333333), -16) + BitShift(0xFF * HUEtoRGB($p, $q, $h), -8) + BitShift(0xFF * HUEtoRGB($p, $q, $h + 0.33333333), 0) EndFunc Func HUEtoRGB($p, $q, $t) If($t < 0) Then $t += 1 If($t > 1) Then $t -= 1 If($t < 0.16666666) Then Return $p + ($q - $p) * 6 * $t If($t < 0.5) Then Return $q If($t < 0.66666666) Then Return $p + ($q - $p) * (0.66666666 - $t) * 6 Return $p EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, 'hWndFrom') Local $Code = DllStructGetData($tNMHDR, 'Code') Local $IDFrom = DllStructGetData($tNMHDR, 'IDFrom') Switch $hWndFrom Case $hSlider Switch $Code Case $NM_CUSTOMDRAW Local $tNMCD = DllStructCreate($tagNMCUSTOMDRAW, $lParam) Local $DrawStage = DllStructGetData($tNMCD, 'DrawStage') Local $ItemSpec = DllStructGetData($tNMCD, 'ItemSpec') Local $hDC, $hMemDC, $hPrev Switch $DrawStage Case $CDDS_PREPAINT DllStructSetData($tNMCD, 'ItemState', BitXOR(DllStructGetData($tNMCD, 'ItemState'), $CDIS_FOCUS)) ; Remove focus Rectangle Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT Local $nLeft = DllStructGetData($tNMCD, 'Rect', 1) Local $nTop = DllStructGetData($tNMCD, 'Rect', 2) Local $nRight = DllStructGetData($tNMCD, 'Rect', 3) Local $nBottom = DllStructGetData($tNMCD, 'Rect', 4) Local $nWidth = $nRight - $nLeft Local $nHeight = $nBottom - $nTop $hDC = DllStructGetData($tNMCD, 'hDC') Switch $ItemSpec Case $TBCD_TICS Return $CDRF_SKIPDEFAULT ; draw custom ticks from bitmap or remove tics ;Return $CDRF_DODEFAULT ; draw tics from current theme Case $TBCD_CHANNEL $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hPrev = _WinAPI_SelectObject($hMemDC, $hHBitmap) _WinAPI_BitBlt($hDC, $nLeft + 10, $nTop - 16, $iWidth - 20, $iHeight, $hMemDC, 0, 0, $MERGECOPY) _WinAPI_SelectObject($hMemDC, $hPrev) _WinAPI_DeleteDC($hMemDC) Return $CDRF_SKIPDEFAULT ;custom draw channel with bitmap or remove channel ;Return $CDRF_DODEFAULT ;draw channel from current theme Case $TBCD_THUMB If ($nWidth - $bmWidth) > 0 Then $nLeft += (($nWidth - $bmWidth) / 2) $nWidth = $bmWidth EndIf If ($nHeight - $bmHeight) > 0 Then $nTop += ($nHeight - $bmHeight) / 2 $nHeight = $bmHeight EndIf $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hPrev = _WinAPI_SelectObject($hMemDC, $hHBitmap2) _WinAPI_BitBlt($hDC, $nLeft, $nTop - 10, $nWidth, $nHeight, $hMemDC, 0, 0, $SRCCOPY) _WinAPI_SelectObject($hMemDC, $hPrev) _WinAPI_DeleteDC($hMemDC) Return $CDRF_SKIPDEFAULT ;custom draw thumb with bitmap EndSwitch EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY You have to do some adjustments in WM_NOTIFY function when you modify the slider settings!
    2 points
  2. A tray application fetching wallpaper from Bing with features: 1. Get today's wallpaper; 2. Get latest 5 days' wallpaper; 3. Choose random wallpaper from images downloaded; 4. Change wallpaper automatically every 1/5/15 minutes or not; 5. Browser to image folder(exe folder). bing.au3 bing.exe
    1 point
  3. JLogan3o13

    File looping (HELP)

    I meant the text file you are pulling from. For code, in the future, just use the code tags <> when you post. I updated your first post so you can see how it looks.
    1 point
  4. Jos

    File looping (HELP)

    Check the helpfile for the proper #include file to add which is currently missing in the code. Jos
    1 point
  5. Subz

    File looping (HELP)

    Try this: AutoItSetOption('MouseCoordMode', 0) AutoItSetOption('SendKeyDelay', 7) Global $sParts = @ScriptDir & "\Parts.txt" ;~ String Variable pointing to Parts.txt file Global $aParts ;~ Array Variable _FileReadToArray($sParts, $aParts) For $i = 1 To $aParts[0] WinWait("Creo Parametric") WinActivate("Creo Parametric") sleep(2000) MouseClick('primary', 1300, 292, 1, 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;This part of the code is for assigning a var to a part ;it stores the var then paste it into the search field and hits enter ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ClipPut($aParts[$i]) Send('^v') Send("{ENTER}") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This part of the code executes in PDP and will show the results of ; the ClipPut ("Value") and will show the part in PDP ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; sleep(4000) WinWait("Creo Parametric") WinActivate("Creo Parametric") MouseClick('primary', 372, 595, 1, 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This part of the code executes in PDP and will click on the Action button ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; sleep(4000) WinWait("Creo Parametric") WinActivate("Creo Parametric") MouseClick('primary', 312, 366, 1, 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This part of the code executes in PDP and will click on the Action button, scroll ; down, right, enter then it will open in Creo and populate the 3D model ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; sleep(5000) Send('{DOWN}') Send('{RIGHT}') sleep(4000) Send("{ENTER}") Sleep(7000) Send("{ENTER}") Sleep(9000) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This part of the code executes in Creo and will click on the X button To ; Close the current window another way to do this is WinClose funtion ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MouseClick('Primary', 610, 84, 1, 0) Sleep(4000) Send('{DOWN 4}') Sleep(4000) Send("{ENTER}") WinWaitActive("Parameter Status",'') Send("{ENTER}") WinWaitActive("Parameter Status",'') Send("{ENTER}") Sleep(4000) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This part of the code executes in Creo and bring back the PDP search link ; Make sure to have MapKey created in Creo call it qq so when its called ; it will close the object in creo ; ; Another Mapkey that needs to be created is ss so it can bring up the PDP search ; site. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WinWait("Creo Parametric") WinActivate("Creo Parametric") Send("qq") Sleep(4000) Send("ss") ;This will make it repeat til i reaches 3 Next
    1 point
  6. czardas

    Random function

    Or use an array of functions. Global $aFunc = [Buzz, Noisy, Lazy] For $i = 1 To 10 $aFunc[Random(0, 2, 1)]() Next Func Buzz() Beep(175, 750) EndFunc Func Noisy() Beep() EndFunc Func Lazy() Sleep(1000) EndFunc
    1 point
  7. Hi, Chimp Here is a way to use a msgbox or alert in jscript. Local $oSC = ObjCreate("ScriptControl") $oSC.Language = "JScript" local $jcode = "function alert(iData,iTitle,iFlag,timeout){" & _ "iTitle = iTitle || 'Info';" & _ "iFlag = iFlag || 64;" & _ "timeout = timeout || 0;" & _ "return new ActiveXObject('WScript.Shell').Popup(iData,timeout,iTitle,iFlag);}" $oSC.AddCode($jcode) $oSC.ExecuteStatement("alert('I am a javascript alert box!')") MsgBox(0,'AutoIt','Pause') This runs on IE 11 win 7.
    1 point
  8. Melba23

    Associative Array

    Mau, Looks like you missed this one: And you might want to search the forum for discussion of the Beta Map datatype. M23
    1 point
×
×
  • Create New...