Sign in to follow this  
Followers 0
DaProgrammer

Slide Show Maker

25 posts in this topic

#1 ·  Posted (edited)

This is the Small Version, i won't release the code for the Gui Version for now, though i highly reccomend Downloading it :)

just put the script in the same folder with some .jpg files and run.

#region - Settings
HotKeySet("{ESC}", "Terminate")
Opt("WinTitleMatchMode", 3)

;Error Msg if no .jpg files were found
If Not FileExists(@ScriptDir & "\*.jpg") Then
    MsgBox(16 + 262144, "Error", 'No JPG files were found')
    Exit
EndIf
#endregion
;
#region - Load Images to Array
;Count the number of files
Local $i = 0
$search = FileFindFirstFile(@ScriptDir & "\" & "*.jpg")
While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    $i = $i + 1
WEnd
FileClose($search)

;Define an Array to contain the files and ratio
Global $Files[$i + 1][2]
$Files[0][0] = $i

;Load file names and image ratio to the Array
$i = 0
$search = FileFindFirstFile(@ScriptDir & "\" & "*.jpg")
While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    $sizee = _GetJpegSize(@ScriptDir & "\" & $file)
    $i = $i + 1
    $Files[$i][0] = "\" & $file
    $Files[$i][1] = $sizee[0] / $sizee[1]
WEnd
FileClose($search)
#endregion
;
#region - Main
$Location = 1

;Create GUI (gray Background)
Global $FullGui = GUICreate(@ScriptName & " FullScreen_bg", @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000, 0x00000008)
GUISetState(@SW_SHOW, $FullGui)

;Show 1st Picture
ShowPic($Location)

;Run the Picture change Func every 5000 ms.
AdlibEnable("Nextt", 5000)

;Loop so Program wont shut down
While 1
    Sleep(1000)
WEnd

Func ShowPic($i)
   ;Fade out old Picture
    For $x = 254 To 1 Step - 5
        WinSetTrans(@ScriptName & "FullScreen_img", "", $x)
    Next
    SplashOff()
    
   ;Create new Picture out of screen --> set trans to 0 --> move back to center
    $ImageSize = GetNewImageSize($Files[$i][1], @DesktopWidth, @DesktopHeight)
    SplashImageOn(@ScriptName & "FullScreen_img", @ScriptDir & "\" & $Files[$i][0], $ImageSize[0], $ImageSize[1], 5000, 5000, 1)
    WinSetTrans(@ScriptName & "FullScreen_img", "", 0)
    WinMove(@ScriptName & "FullScreen_img", "", (@DesktopWidth - $ImageSize[0]) / 2, (@DesktopHeight - $ImageSize[1]) / 2)
    
   ;Fade in new Picture
    For $x = 1 To 254 Step 5
        WinSetTrans(@ScriptName & "FullScreen_img", "", $x)
    Next
EndFunc  ;==>ShowPic

;Func written by me :) , Returns a new Resolution based on area to work with
;and original resolution ratio --> in a 2dim Array
Func GetNewImageSize($OrigRatio, $WorkAreaWidth, $WorkAreaHight)
    Local $NewImageSize[2]
    If $OrigRatio < $WorkAreaWidth / $WorkAreaHight Then
        $NewImageSize[0] = $WorkAreaHight * $OrigRatio
        $NewImageSize[1] = $WorkAreaHight
    Else
        $NewImageSize[0] = $WorkAreaWidth
        $NewImageSize[1] = $WorkAreaWidth / $OrigRatio
    EndIf
    Return $NewImageSize
EndFunc  ;==>GetNewImageSize

;Shows Next picture every 5000 ms (as specified in the AdlibEnable above)
Func Nextt()
    If $Location < $Files[0][0] Then
        $Location = $Location + 1
    Else
        $Location = 1
    EndIf
    ShowPic($Location)
EndFunc  ;==>Nextt

;Gess what this does ???
Func Terminate()
    Exit
EndFunc  ;==>Terminate

#endregion
;
#region - JPEG
;===============================================================================
;
; Description:    Return JPEG size
; Parameter(s):  File name
; Requirement(s):   None
; Return Value(s):  On Success - array with width and height
;                  On Failure empty string and sets @ERROR:
;                      1 - File is not valid JPEG
;                      2 - Info not found
; Author(s):        YDY (Kot) <mpc@nm.ru>
; Version:        1.1.00
; Date:          10.08.2004
; Note(s):        None
;
;===============================================================================
Func _GetJpegSize($file)
    Local $size[2]
    Local $fs, $pos = 3

    $fs = FileGetSize($file)

    While $pos < $fs
        $data = _FileReadAtOffsetHEX($file, $pos, 4)
        If StringLeft($data, 2) = "FF" Then
            If StringInStr("C0 C2 CA C1 C3 C5 C6 C7 C9 CB CD CE CF", StringMid($data, 3, 2)) Then
                $seg = _FileReadAtOffsetHEX($file, $pos + 5, 4)
                $size[1] = Dec(StringLeft($seg, 4))
                $size[0] = Dec(StringRight($seg, 4))
                Return ($size)
            Else
                $pos = $pos + Dec(StringRight($data, 4)) + 2
            EndIf
        Else
            ExitLoop
        EndIf
    WEnd
    SetError(2)
    Return ("")
EndFunc  ;==>_GetJpegSize
;
Func _FileReadAtOffsetHEX($file, $offset, $bytes)
    Local $tfile = FileOpen($file, 0)
    Local $tstr = ""
    FileRead($tfile, $offset - 1)
    For $i = $offset To $offset + $bytes - 1
        $tstr = $tstr & Hex(Asc(FileRead($tfile, 1)), 2)
    Next
    FileClose($tfile)
    Return ($tstr)
EndFunc  ;==>_FileReadAtOffsetHEX
#endregion

The Gui Version is in the .zip file attached, heres a Screenshot.

Posted Image

SlideShow Maker (with GUI UI)

Instructions

Place all .jpg and .mp3 files in a folder named "Files"

Features

Plays .mp3 files

Normal SlideShow + FullScreen SlideShow

SlideShow delay slidebar

Save Pictures to folder feature (very usefull for making gift CD with photos)

Pretty buttons ;)

Hotkeys

LEFT = Previous picture

RIGHT = Next Picture

SPACE = Play / Pause Slideshow

ENTER = Go to fullscreen mode

ESC = Exit

Slide_Show_1.2.zip

Edited by DaProgrammer

Share this post


Link to post
Share on other sites

Nice! Waiting for the gui code... :)

Share this post


Link to post
Share on other sites

Nice! Waiting for the gui code... ;)

u saw The Gui Version or u 1 of those who are afraid to test .exe files :) ?

Share this post


Link to post
Share on other sites

nice udf ;) and nice looking gui

u saw The Gui Version or u 1 of those who are afraid to test .exe files :) ?

I think he meant he looks forward to seeing the code since you mentioned that you highly recommend showing the code.


A decision is a powerful thing

Share this post


Link to post
Share on other sites

nice udf :) and nice looking gui

I think he meant he looks forward to seeing the code since you mentioned that you highly recommend showing the code.

i said i highly reccomend using it since its ub33r nice ;)


Share this post


Link to post
Share on other sites

wow this is pretty cool! I love the gui :)

tmx man, i was amazed myself at how pretty it came out ;)

Comments on bugs and gliches will be welcome.


Share this post


Link to post
Share on other sites

Don't care much for the exe files.. I like being able to see what is going to happen when I run a file.. I did run yours tho and it is a very nice gui, just would rather see the code.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Nice job! about the gui? why didnt you supply the source to that too??

Its very messy, split into many files, many icon files, modefied XSkin, and a shitload of a mess that i made :)

the .exe works and i aint got the powa to clean the soure !

unless some1 reports a bug or something to fix, by this time tommorow i'll probably be off to my next project.

just need to figure out what it will be, LOL

p.s. some ideas will be nice

Edited by DaProgrammer

Share this post


Link to post
Share on other sites

39 downloads and so little replys ? common ppl ill fix that bug thats bugging u :)


Share this post


Link to post
Share on other sites

we like the source to things...

Share this post


Link to post
Share on other sites

Cannot run the exe, gives error on line 1.

Share this post


Link to post
Share on other sites

Cannot run the exe, gives error on line 1.

give the entire error plz couse compiled script always says line1 but it isnt really line1 :)


Share this post


Link to post
Share on other sites

give the entire error plz couse compiled script always says line1 but it isnt really line1 :)

It only says line 1

Share this post


Link to post
Share on other sites

dont have time ATM but will upload newer version in a couple of huores maybe it will fix ur error.


Share this post


Link to post
Share on other sites

Its very messy, split into many files, many icon files, modefied XSkin, and a shitload of a mess that i made :)

the .exe works and i aint got the powa to clean the soure !

unless some1 reports a bug or something to fix, by this time tommorow i'll probably be off to my next project.

just need to figure out what it will be, LOL

p.s. some ideas will be nice

Maybe if you posted the source, its more than likely someone will followup with clean version of your code.

Just a suggestion.


Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

I get an error, maybe what was related to Generators.

I put the GUI version of the program in a folder with 104 of .JPG Files.

It said it didnt find any... Is the file search in your program case sensitive(.jpg it will find, .JPG it wont)?

It doesnt do that with the source..

Share this post


Link to post
Share on other sites

I get an error, maybe what was related to Generators.

I put the GUI version of the program in a folder with 104 of .JPG Files.

It said it didnt find any... Is the file search in your program case sensitive(.jpg it will find, .JPG it wont)?

It doesnt do that with the source..

if u read what it says 'No JPG files were found in the Folder: "Files"' than ull see u have to put the jpg in a folder named "Files"


Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0