Jump to content

View pictures and move them into folder by pressing a key


TheMike
 Share

Recommended Posts

Hi,

I'd like to creat a script to view pictures (with the Windows picture viewer) and sort them into different subfolder by pressing a key.

At first:

Open the selected picture with the Windows picture viewer

Create subfolder 1, 2 and 3 in current directory.

Then:

Key A -> move picture to folder 1 and show the next picture

Key B -> move picture to folder 2 and show the next picture

Key C -> move picture to folder 3 and show the next picture

Is this possible do create a script like this with AutoIT?

Gruß!

Mike

Link to comment
Share on other sites

Yes, it certainly is, I think.

You will need to look at WinGetTitle() function to begin with.

This will enable you to get the full title of the Windows picture/photo viewer window, which has in it the name of the picture you are viewing, so when you hit the key, it knows what file to move.

StringSplit should be able to split the image title from the whole window title.

Have a little read on the functions, and an experiment, and feel free to come back with any questions or problems, remembering to post up any code you have tried.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Seeing as how I am at a loose end, here is a short example code, which needs Windows Photo Viewer to exist with a picture in it.

I'm not 100% sure the same code will work picture viewer, however just change the wording in code to try.

Each line is commented so you know what its doing, but dont forget there is a lot more for you to do, to get your complete code, and you may use a different method than the one below.

Opt("WinTitleMatchMode", 2) ; This Flag "2" Matches substring in window title

$sWinTitle = WinGetTitle("Windows Photo Viewer") ; Get the full title of the photo viewer window
If $sWinTitle Then ; Check The function found a match
    ConsoleWrite($sWinTitle & @CRLF) ; Write full title in console output window
    $aSplitWinTitle = StringSplit($sWinTitle, " - ", 3) ;Split the full title
    If Not @error Then ; Check StringSlit function was successful
        $sImageTitle = $aSplitWinTitle[0] ; Set a new variable to the first element of the array created by StringSplit
        ConsoleWrite($sImageTitle & @CRLF) ; Write Image title in console output window
    Else
        MsgBox(0,"StringSplit Error",@error) ; There was an error in StringSplit
    EndIf
Else
    MsgBox(0,"WinGetTitle Error","No Match Found") ; There was an error in WinGetTitle
EndIf

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 3 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...