Popular Post Andreik Posted February 2 Popular Post Posted February 2 (edited) This is a basic UDF to create nice slideshows. There are a lot of customizable options so it might be useful in some projects. Here is an example: expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include "Slideshow.au3" Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() There might be some hidden bugs. If you encounter any just let me know. Tip: use SlideshowEx.au3 if you don't want to preload the images Slideshow.au3SlideshowEx.au3 Edited March 21 by Andreik SlideshowEx Xandy, van_renier, kurtykurtyboy and 5 others 6 2
SOLVE-SMART Posted February 2 Posted February 2 (edited) Wow @Andreik, this is awesome 👌 . I guess I will have some use cases where I want to use slides, so thank you! ------------------ A warning about the UDF when you these AutoIt directive params: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 Warning: "c:\Store\Repositories\Tests\Slideshow.au3"(130,15) : warning: $nIndex: declared, but not used in func. Local $nIndex ~~~~~~~~~~~~~^ Maybe you want to fix it, because it's a easy one 😅 . And ones again, thank you, good job 👌 . Best regards Sven Edited February 2 by SOLVE-SMART Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
Andreik Posted February 2 Author Posted February 2 6 minutes ago, SOLVE-SMART said: Few warnings about the UDF when you use some AutoIt directives like these: Solved.
SOLVE-SMART Posted February 2 Posted February 2 59 minutes ago, Andreik said: Solved. Thanks again. One last thing and I am feel sorry about to mention it 😊 Please also adjust your attachment which wasn't updates like your code in the post #1 yet. I hope it's more helpful than annoying 🤞 . Best regards Sven Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
Andreik Posted February 2 Author Posted February 2 Don't worry, your feedback it's welcome. It was early in the morning and I was so sleepy that I forgot about attachment. It should be fine now. SOLVE-SMART and Xandy 2
van_renier Posted March 4 Posted March 4 (edited) Figured it out my earlier problem (loading the image list from a file) - not exactly sure what changed, but it's now working as intended). Is there any way to set the slideshow to be displayed in full-screen (with no title bar) ? I tried the @DesktopWidth and @DesktopHeight variables, but it still has the title bar on the window. Thanks, Van Edited March 4 by van_renier thought of a possible reason (array size too large).
ioa747 Posted March 4 Posted March 4 (edited) Thank you for sharing it with us Edited March 4 by ioa747 I know that I know nothing
Andreik Posted March 4 Author Posted March 4 (edited) @van_renier Of course you can change the size of you slideshow as you wish. expandcollapse popup#include "Slideshow.au3" #include <WindowsConstants.au3> Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include "Slideshow.au3" #include <WindowsConstants.au3> Global $iW = @DesktopWidth - 60 Global $iH = @DesktopHeight - 60 Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w' & $iW & '-h' & $iH & '-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w' & $iW & '-h' & $iH & '-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w' & $iW & '-h' & $iH & '-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w' & $iW & '-h' & $iH & '-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $hGUI, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 30, 30, $iW, $iH, $avImage, $mOptions) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() Edited March 4 by Andreik
UEZ Posted March 4 Posted March 4 Very nice @Andreik What about a cross-fade from one image to another? 😊 Andreik 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
UEZ Posted March 4 Posted March 4 I coded a cross-fade effect using _GDIPlus_ColorMatrixCreateTranslate(). If you like, I can share the code if it hasn't already been posted somewhere in the depths of this forum... van_renier 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Andreik Posted March 4 Author Posted March 4 I was thinking to use some assembly code to blend current bitmap with the previous bitmap but if you already have some code, I'll gladly use it.
UEZ Posted March 4 Posted March 4 This is a code from 2012! expandcollapse popup#include <GuiSlider.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() Global Const $ghGDIPDll = $__g_hGDIPDll Global $iW = 800, $iH = 600 Global Const $hHBmp = _ScreenCapture_Capture("", 0, 0, $iW, $iH) Global Const $hBGBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) _WinAPI_DeleteObject($hHBmp) Global Const $hFGBmp = _Blur($hBGBmp, $iW, $iH) Global Const $hGUI = GUICreate("GDI+ Test by UEZ 2012", $iW, $iH) Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global Const $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ;~ Global Const $tagGDIPCOLORMATRIX = "float m[25];" Global $hAttribute_Alpha = _GDIPlus_ImageAttributesCreate() Global $tColorMatrix = _GDIPlus_ColorMatrixCreateTranslate(0, 0, 0, 0) Global $pColorMatrix = DllStructGetPtr($tColorMatrix) _GDIPlus_ImageAttributesSetColorMatrix($hAttribute_Alpha, 0, True, $pColorMatrix) GUISetState(@SW_SHOW, $hGUI) GUISetOnEvent(-3, "_Exit") For $i = -1 To 0 Step 0.025 Set_Transparency($i) Next While Sleep(20000) WEnd Func Set_Transparency($fTransparency = 0) $tColorMatrix = _GDIPlus_ColorMatrixCreateTranslate(0, 0, 0, $fTransparency) $pColorMatrix = DllStructGetPtr($tColorMatrix) _GDIPlus_ImageAttributesSetColorMatrix($hAttribute_Alpha, 0, True, $pColorMatrix) Draw() EndFunc Func Draw() _GDIPlus_GraphicsDrawImage($hContext, $hBGBmp, 0, 0) _GDIPlus_GraphicsDrawImageRectRectIA($hContext, $hFGBmp, 0, 0, $iW, $iH, 0, 0, $iW, $iH, $hAttribute_Alpha) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) EndFunc Func _Exit() For $i = 0 To -1 Step -0.025 Set_Transparency($i) Next _GDIPlus_ImageAttributesDispose($hAttribute_Alpha) _GDIPlus_BitmapDispose($hBGBmp) _GDIPlus_BitmapDispose($hFGBmp) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose ($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndFunc Func _Blur($hBitmap, $iW, $iH, $dx1 = 0, $dy1 = 4, $dx2 = 0, $dy2 = 0, $fScale = 0.175, $qual = 6); by eukalyptus Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow()) Local $hBmpSmall = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "handle", $hGfxSmall, "int", 2) Local $hBmpBig = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "handle", $hGfxBig, "int", 2) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy1) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur Func _GDIPlus_GraphicsDrawImageRectRectIA($hGraphics, $hImage, $nSrcX, $nSrcY, $nSrcWidth, $nSrcHeight, $nDstX, $nDstY, $nDstWidth, $nDstHeight, $hImageAttributes = 0, $iUnit = 2) Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRect", "handle", $hGraphics, "handle", $hImage, "float", $nDstX, "float", $nDstY, "float", $nDstWidth, "float", $nDstHeight, "float", $nSrcX, "float", $nSrcY, "float", $nSrcWidth, "float", $nSrcHeight, "int", $iUnit, "handle", $hImageAttributes, "int", 0, "int", 0) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectIA Andreik 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Andreik Posted March 4 Author Posted March 4 Added transition effect between slides. Thanks @UEZ. UEZ 1
van_renier Posted March 5 Posted March 5 (edited) Andreik, i'm getting this error when trying to start the slideshow, whenever I try and pass an argument of $mOptions to the slideshow. The below-referenced slideshow.au3 is exactly what I downloaded from the autoitscript.com forums: ------------------------------------------------------ Text: Line 248 (File "Z:\_temp\MoviePostersSlideshow\1304hrs_w_mods\Slideshow.au3"): If TimerDiff($mSlideshow['LastEvent']) < $__mSlideshows['EventsRate'] Then Return False If TimerDiff($mSlideshow^ ERROR ------------------------------------------------------ This is a code snippet from the main/calling script: [...] Global $mOptions[] $mOptions['ImageType'] = 'Local' $mOptions['ShowCaptions'] = True $mOptions['AutoPlay'] = True $mOptions['Delay'] = 15000 $mOptions['CornerRadius'] = 0 $mOptions['ShowSlides'] = False $mOptions['ShowButtons'] = False Global $hGUI, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('', @DesktopWidth, @DesktopHeight, 0,0, $WS_POPUPWINDOW, $WS_EX_TOPMOST ) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 0, 0, @DesktopWidth, @DesktopHeight, $avImage, $mOptions) [...] But the error does NOT occur if the last/calling line in the above snippet omits passing $mOptions as an argument, but then, those options aren't being set in the resulting output. WORKS: $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 0, 0, @DesktopWidth, @DesktopHeight, $avImage ) DOES NOT work: $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 0, 0, @DesktopWidth, @DesktopHeight, $avImage, $mOptions ) I also tried adding them into the slideshow.au3 file itself starting at line 47: $__mSlideshows['ImageType'] = 'Local' $__mSlideshows['AutoPlay'] = True $__mSlideshows['ShowSlides'] = False $__mSlideshows['ShowCaptions'] = False $__mSlideshows['Delay'] = 5000 $__mSlideshows['CornerRadius'] = 0 $__mSlideshows['ShowButtons'] = False ...but they don't take affect there either (as I still see the control buttons, ShowSlides IS active, and CornerRadius still rounded off at 10 (and the initial error in this post is from BEFORE trying to add the array values in that script). Any suggestions? Thanks, Van Edited March 5 by van_renier
Andreik Posted March 5 Author Posted March 5 (edited) If you don't provide enough information I cannot help you. Post a runnable code so I can see what is your problem. Below it's an example without options and it's still running fine. expandcollapse popup#include <Slideshow.au3> Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] ; Download on local disk some images For $Index = 0 To UBound($avImage) - 1 InetGet($avImage[$Index], @ScriptDir & '\' & $Index & '.jpg', 1, 0) $avImage[$Index] = @ScriptDir & '\' & $Index & '.jpg' Next Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] ;~ Global $mOptions[] ;~ $mOptions['ImageType'] = 'URL' ;~ $mOptions['Captions'] = $asCaptions ;~ $mOptions['ShowCaptions'] = True ;~ $mOptions['CornerRadius'] = 0 Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage) ; <<<--- No options GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() You can check in your code if there is an error after the slideshow it's created. $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 0, 0, @DesktopWidth, @DesktopHeight, $avImage, $mOptions) If @error Then MsgBox(0x10, 'Error', 'Error number: ' & @error) Edited March 5 by Andreik
van_renier Posted March 5 Posted March 5 Yeah, sorry. I was trying to make it a little easier for everyone to focus in on the possibly cause, Sorry, from now on, I'll post the actual whole code to troubleshoot. I found the issue, though; $mOptions['ShowCaptions'] = True Should've been: $mOptions['ShowCaptions'] = False Thanks, Van
Andreik Posted March 5 Author Posted March 5 (edited) 10 minutes ago, van_renier said: Should've been: $mOptions['ShowCaptions'] = False Well, if you set $mOptions['ShowCaptions'] = True then you need to set also $mOptions['Captions']. Edited March 5 by Andreik
van_renier Posted March 15 Posted March 15 Andreik, Is there any way to reduce the memory overhead of your slideshow function? Right now, it loads all the poster images into memory before even presenting the 1st poster. Is it possible to modify it to load up, say 5 rotating, posters at a time, and then load/process the next poster to be in that 5 processed images when the 1st is done? like a rolling 5 images or something similar? I realize this might be more overall load on the system (constantly loading/processing, presenting, then releasing them only to reload them when their time comes back up? Right now, the slideshow function is sucking up well over 3.2GB of RAM, for about 900 posters, I currently have ~500+ movie posters in my active rotation), for that, before I even see the 1st poster, the script is sucking up memory (and CPU) to prepare the images for display (even if it never gets past the 1st 100 images). Don't get me wrong, this is a great function, and I'll continue to use it (until I figure out how to script like you did for this feature 🙂 ), but if it could be a little less gung-ho with prepping for displaying images this would be great! Thanks, Van
Andreik Posted March 15 Author Posted March 15 (edited) Never thought someone will use it with so many slides. Bad news it's that changing the actual implementation and don't preload the images it means to change almost every function. Good news is that there are not so many lines of code and it's doable without a considerable effort. I might do a version without loading the images in advance in this weekend. Edited March 15 by Andreik SOLVE-SMART and van_renier 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now