Jump to content

Search the Community

Showing results for tags 'slideshow'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. Hi I am trying to make a gui that uses a slide to change pictures and uses internet-read from guinness function. Thanks for your help. Ok found the issue #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPIRes.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 229, 165, 2392, 436) $Slider = GUICtrlCreateSlider(32, 128, 150, 29) GUICtrlSetLimit($Slider, 2, 1) GUICtrlSetData($Slider, 1) GUICtrlSetBkColor($Slider, 0x0099FF) GUICtrlSetColor(-1, 0xA6CAF0) $hSlider_Handle = GUICtrlGetHandle(-1) $sFile1 = _GetURLImage("http://www.pendriveapps.com/wp-content/uploads/autoit.jpg ", @TempDir) $sFile2 = _GetURLImage("http://domoticx.com/wp-content/uploads/autoit-logo-200x154.jpg ", @TempDir) $Hpic1 = GUICtrlCreatePic($sFile1, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Slider $a = GUICtrlRead($Slider) If $a = 2 Then GUICtrlDeleteImage($Hpic1) $Hpic2 = GUICtrlCreatePic($sFile2, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) ElseIf $a = 1 Then GUICtrlDeleteImage($hpic2) $Hpic1 = GUICtrlCreatePic($sFile1, 56, 8, 108, 108, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) EndIf EndSwitch WEnd Func _GetURLImage($sURL, $sDirectory = @ScriptDir) ; Author ........: guinness Local $hDownload, $sFile $sFile = StringRegExpReplace($sURL, "^.*/", "") If @error Then Return SetError(1, 0, $sFile) EndIf If StringRight($sDirectory, 1) <> "\" Then $sDirectory = $sDirectory & "\" EndIf $sDirectory = $sDirectory & $sFile If FileExists($sDirectory) Then Return $sDirectory EndIf $hDownload = InetGet($sURL, $sDirectory, 17, 1) While InetGetInfo($hDownload, 2) = 0 If InetGetInfo($hDownload, 4) <> 0 Then InetClose($hDownload) Return SetError(1, 0, $sDirectory) EndIf Sleep(105) WEnd InetClose($hDownload) Return $sDirectory EndFunc ;==>_GetURLImage Func GUICtrlDeleteImage($iCtrlID) ; Author ........: guinness Local Const $STM_SETIMAGE = 0x0172 Local $aSetImage = 0, _ $bReturn = True, _ $iMsg = 0 Switch _WinAPI_GetClassName($iCtrlID) Case 'Button' ; button, checkbox, groupbox, radiobutton. Local $aButton = [$IMAGE_BITMAP, $IMAGE_ICON] $aSetImage = $aButton $aButton = 0 Case 'Static' ; icon, label, picture. Local $aStatic = [$IMAGE_BITMAP, $IMAGE_CURSOR, $IMAGE_ICON] $aSetImage = $aStatic $aStatic = 0 $iMsg = $STM_SETIMAGE Case Else $bReturn = False EndSwitch If $bReturn Then $bReturn = False Local $hImage = 0 For $i = 0 To UBound($aSetImage) - 1 $hImage = GUICtrlSendMsg($iCtrlID, $iMsg, $aSetImage[$i], 0) If $hImage <> 0 Then Switch $aSetImage[$i] Case $IMAGE_BITMAP $bReturn = _WinAPI_DeleteObject($hImage) Case $IMAGE_CURSOR $bReturn = _WinAPI_DeleteObject($hImage) If Not $bReturn Then $bReturn = _WinAPI_DestroyCursor($hImage) > 0 EndIf Case $IMAGE_ICON $bReturn = _WinAPI_DeleteObject($hImage) If Not $bReturn Then $bReturn = _WinAPI_DestroyIcon($hImage) > 0 EndIf EndSwitch ExitLoop EndIf Next If Not $bReturn Then $bReturn = GUICtrlSetImage($iCtrlID, 'shell32.dll', -50) > 0 EndIf EndIf Return $bReturn EndFunc ;==>GUICtrlDeleteImage
  2. While looking for a way to change my desktop background of only my secondary monitor, I found a few simple solutions that are built into Windows. But when you look up how to do such with a slideshow... You only find programs that cost money. So, I set out to make it myself.This is a pretty basic program. It simply displays an image in the center of the screen (scaled to fit screen) and uses a black background.The program does allow mouse passthrough, though you can't drag and drop over it, so it wouldn't really work well if you have icons on your second monitor. #include <File.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <Misc.au3> #include <Array.au3> #include <GDIPlus.au3> ;User Changeable Variables ;======================================================================== $pictureFolder = "D:\Wallpapers" $changeTime = 5 ;Seconds Global $smWidth = 1600 Global $smHeight = 900 Global $monitorPosition = "Right" ;Global $monitorPosition = "Left" ;======================================================================== Global $imageList = _FileListToArray($pictureFolder) Global $imageCount = $imageList[0] Global $imageHeight, $imageWidth, $pHeight, $pWidth, $pic, $gdiPic _GDIPlus_Startup() OnAutoItExitRegister("CloseProgram") $GUIStyle = BitOR($WS_POPUP, $WS_VISIBLE, $HWND_BOTTOM) ;Popup, Visible, Window on Bottom $GUIStyleEx = BitOR($WS_EX_TRANSPARENT, $WS_EX_TOOLWINDOW) ;Allow Passthrough, Hide from Alt+Tab $Parent = WinGetHandle('Program Manager', '') ;Sets parent to the program manager, allowing you to right click the desktop If $monitorPosition = "Right" Then $GUI = GUICreate("Secondary Wallpaper", $smWidth, $smHeight, @DesktopWidth, 0, $GUIStyle, $GUIStyleEx, $Parent) Else $GUI = GUICreate("Secondary Wallpaper", $smWidth, $smHeight, (-1 * @DesktopWidth), 0, $GUIStyle, $GUIStyleEx, $Parent) EndIf GUISetBkColor(0, $GUI) _WinAPI_SetWindowPos($GUI, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_SHOWWINDOW)) ;Forces window to bottom of screen WinSetTrans($GUI, '', 255) ;Sets Window Visible Transparency: Required for mouse passthrough ChangeImage() GUISetState(@SW_SHOW) ;Show GUI While 1 Sleep($changeTime * 1000) ChangeImage() WEnd Func ChangeImage() $picName = Random(1, $imageCount, 1) ;Get Dimensions of image GetDimensions($imageList[$picName]) $imageHeight = $pHeight $imageWidth = $pWidth ;Turn them all into integers. (Fixes glitch that caused some images to skip resizing) $imageHeight = Int($imageHeight) $imageWidth = Int($imageWidth) $smHeight = Int($smHeight) $smWidth = Int($smWidth) ;Adjust the image size ;----------------------------------------------- ;If the image is bigger than the screen, adjust it If $imageWidth > $smWidth = 1 Or $imageHeight > $smHeight = 1 Then ;Calculate Aspect Ratio of image $aspectRatioX = $smWidth / $imageWidth $aspectRatioY = $smHeight / $imageHeight If $aspectRatioX < $aspectRatioY Then $scaleFactor = $aspectRatioX Else $scaleFactor = $aspectRatioY EndIf $imageHeight = $imageHeight * $scaleFactor $imageWidth = $imageWidth * $scaleFactor ;Else ;Image is smaller/same size as monitor EndIf ;Calculate Center of monitor ;(Monitor size - image size) / 2 $smCenterX = ($smWidth - $imageWidth) / 2 $smCenterY = ($smHeight - $imageHeight) / 2 ;Resize the image $hHBmp = $pictureFolder & "\" & $imageList[$picName] $gdiPic = _GDIPlus_BitmapCreateFromFile($hHBmp) ;convert GDI bitmap to GDI+ bitmap _GDIPlus_BitmapDispose($pic) $pic = _GDIPlus_ImageResize($gdiPic, $imageWidth, $imageHeight) ;resize image _GDIPlus_BitmapDispose($gdiPic) GUISetBkColor(0, $GUI) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($GUI) ;create a graphics object from a window handle $gdiPic = _GDIPlus_BitmapCreateFromFile($pictureFolder & "\" & $imageList[$picName]) _GDIPlus_GraphicsDrawImage($hGraphics, $pic, $smCenterX, $smCenterY) ;display scaled image _GDIPlus_GraphicsDispose($hGraphics) ;Garbage Cleanup EndFunc ;==>ChangeImage Func GetDimensions($picName) Local $prop, $dArray, $fileSize, $imageDimensionsGDI $path = $pictureFolder & "\" & $picName $fileSize = FileGetSize($path) ;Save information to registry for faster access. Compare size of picture to verify changes to picture If $fileSize <> RegRead("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Size") Then ;File sizes do not match RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Size", "REG_SZ", $fileSize) $imageDimensionsGDI = _GDIPlus_ImageLoadFromFile($path) $pWidth = _GDIPlus_ImageGetWidth($imageDimensionsGDI) $pHeight = _GDIPlus_ImageGetHeight($imageDimensionsGDI) _GDIPlus_ImageDispose($imageDimensionsGDI) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Width", "REG_SZ", $pWidth) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Height", "REG_SZ", $pHeight) Else ;File sizes match $pWidth = RegRead("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Width") $pHeight = RegRead("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Height") If $pWidth = "-1" Or $pHeight = "-1" Then RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Size", "REG_SZ", $fileSize) $imageDimensionsGDI = _GDIPlus_ImageLoadFromFile($path) $pWidth = _GDIPlus_ImageGetWidth($imageDimensionsGDI) $pHeight = _GDIPlus_ImageGetHeight($imageDimensionsGDI) _GDIPlus_ImageDispose($imageDimensionsGDI) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Width", "REG_SZ", $pWidth) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Height", "REG_SZ", $pHeight) EndIf EndIf EndFunc ;==>GetDimensions Func CloseProgram() ;Garbage Cleanup _GDIPlus_GraphicsDispose($gdiPic) _GDIPlus_Shutdown() EndFunc ;==>CloseProgram Secondary Wallpaper.au3
×
×
  • Create New...