Sign in to follow this  
Followers 0
gertsolo

Picture viewer and vista

3 posts in this topic




#2 ·  Posted (edited)

Upping my post so someone will pick it up (I hope) <_<

You don't have to read the link to the other thread which has a link to another thread if you don't want to.

Basic question: Is there a way to have an image viewer which shows the pictures in a directory with MS Vista? I just want to see them one by one upon clicking a next and previous button (and I will and some more functionality (copy stuff, etc) later, otherwise I would just use a standard image viewer, right :) )

The darn thing is that it works under XP but not with Vista. (No, I am not downgrading it, it's my wife's pc. It ain't broke so I won't try to fix it :P:) )

Edited by gertsolo

The more you learn, the less you know.

Share this post


Link to post
Share on other sites

Cool, I posted a thread and now I'm gonna post a possible solution :P (I should start my own community me, myself and I)

I know it is a workaround, but hey, it works :)

Here's the code. Any comment or improvement is always welcome.

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>

Opt("WinTitleMatchMode", 2)


$HomeDir = "Z:\Kodak Pictures"
$CopyDir = "Z:\Kodak Pictures\_Karin_print"
;Build the list of files based on a directory selection (only jpg)
$Location = FileSelectFolder("Kies een map om te bekijken", $HomeDir)
$FileList = _FileListToArray($Location,"*.jpg")
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf

$n = 1
;run IrfanView with the first file in the array
ShellExecute("C:\Program Files\IrfanView\i_view32.exe",$Location & "\" & $FileList[$n])


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Karin Foto", 312, 274, 800, 10)
$Button1 = GUICtrlCreateButton("Vorige", 32, 32, 105, 57, 0)
$Button2 = GUICtrlCreateButton("Volgende", 171, 33, 105, 57, 0)
$Button3 = GUICtrlCreateButton("Kopieer", 99, 111, 105, 57, 0)
$Button4 = GUICtrlCreateButton("Andere lijst", 196, 179, 105, 30, 0)
$Button5 = GUICtrlCreateButton("Stop", 196, 209, 105, 30, 0)
$Edit1 = GUICtrlCreateEdit($FileList[$n], 32, 189, 135, 30, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
    ;Show the previous picture. If it is the first, show a message and don't do the subtraction
            If $n > 1 Then 
                $n -= 1
                GUICtrlSetData($Edit1,$FileList[$n])
                WinActivate("IrfanView")
                WinWaitActive("IrfanView")
                send("{BACKSPACE}")
                WinActivate("Karin Foto")
                WinWaitActive("Karin Foto")
            Else
                $n = 1
                GUICtrlSetData($Edit1,"Eerste Foto")
            EndIf
            Consolewrite($n & @CR)
        Case $Button2
    ;Show the next picture. If it is the last, show a message and don't do the addition
            If $n < $FileList[0] Then 
                $n += 1
                GUICtrlSetData($Edit1,$FileList[$n])
                WinActivate("IrfanView")
                WinWaitActive("IrfanView")
                send("{SPACE}")
                WinActivate("Karin Foto")
                WinWaitActive("Karin Foto")
            Else
                $n = $FileList[0]
                GUICtrlSetData($Edit1,"Laatste Foto")
            EndIf
            Consolewrite($n & @CR)
        Case $Button3
    ;Copy the file to the wanted directory
            FileCopy($Location & "\" &$FileList[$n],$CopyDir & "\" &$FileList[$n])
            traytip("Hopla",$FileList[$n] & " gekopieerd",1)
        Case $Button4
    ;Give the option to choose a new directory, stop IrfanView and open it again with the new list of pictures and off we are again
            $Location = FileSelectFolder("Kies een map om te bekijken", $HomeDir)
            $FileList = _FileListToArray($Location,"*.jpg")
            GUICtrlSetData($Edit1,$FileList[$n])
            ProcessClose("i_view32.exe")
            ShellExecute("C:\Program Files\IrfanView\i_view32.exe",$Location & "\" & $FileList[$n])
        Case $Button5
            ProcessClose("i_view32.exe")
            exit
    EndSwitch
WEnd

<_< I so luve AutoIt :)


The more you learn, the less you know.

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