Sign in to follow this  
Followers 0
slightly_abnormal

Go To Next Image.. Go Back Image

9 posts in this topic

#1 ·  Posted (edited)

Hi there.. I'm trying to get autoit go through images, in order, and then I can go back images by pressing back, I tried it with arrays.. I don't know whats next, so i just did it the way i know..

heres the image.. it should be different colors for 1 through 5.. i uploaded it as bmp but imageshack made it a png image..

http://img148.imageshack.us/img148/6692/1image2dw.png

#include <GUIConstants.au3>
$Form1 = GUICreate("NextImage", 414, 305, 246, 194)
;~ Dim $Pick[5]
;~ $Pick[1]= GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
;~ $Pick[2]= GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)
;~ $Pick[3]= GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)
;~ $Pick[3]= GUICtrlCreatePic(@ScriptDir&"\4image.bmp", 8, 8, 393, 233)

$Pick = GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
$Back= GUICtrlCreateButton("Back", 160, 256, 97, 41)
$Next = GUICtrlCreateButton("Next", 264, 256, 97, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Back
        GUICtrlCreatePic("1image.bmp", 8, 8, 393, 233)
        GUICtrlCreatePic("2image.bmp", 8, 8, 393, 233)
        GUICtrlCreatePic("3image.bmp", 8, 8, 393, 233)
    Case $msg = $Next
        GUICtrlCreatePic("2image.bmp", 8, 8, 393, 233)
        GUICtrlCreatePic("3image.bmp", 8, 8, 393, 233)
        GUICtrlCreatePic("4image.bmp", 8, 8, 393, 233)
    Case Else
    EndSelect
WEnd
Exit
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1

make sure you fix this...

;~ $Pick[2]= GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)

;~ $Pick[3]= GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)

;~ $Pick[3]= GUICtrlCreatePic(@ScriptDir&"\4image.bmp", 8, 8, 393, 233)

2

use guictrlsetsate( control id, $GUI_HIDE)... and $GUI_SHOW in the loop

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

I dont know what i'm doing :)

#include <GUIConstants.au3>
$Form1 = GUICreate("NextImage", 414, 305, 246, 194)
Dim $Pick[5]
$Pick[1]= GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
$Pick[2]= GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)
$Pick[3]= GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)
$Pick[4]= GUICtrlCreatePic(@ScriptDir&"\4image.bmp", 8, 8, 393, 233)

$Pic = $Pick[1]
$Back= GUICtrlCreateButton("Back", 160, 256, 97, 41)
$Next = GUICtrlCreateButton("Next", 264, 256, 97, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Back
        Guictrlsetstate($Pic,$Pick[1] -1)
    Case $msg = $Next
        Guictrlsetstate($Pic,$Pick[1] +1)
    Case Else
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

:) Now it does the same thing?

#include <GUIConstants.au3>
$Form1 = GUICreate("NextImage", 414, 305, 246, 194)
;~ Dim $Pick[5]
;~ $Pick[1]= GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
;~ $Pick[2]= GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)
;~ $Pick[3]= GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)
;~ $Pick[4]= GUICtrlCreatePic(@ScriptDir&"\4image.bmp", 8, 8, 393, 233)

$Pic = GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
$Back= GUICtrlCreateButton("Back", 160, 256, 97, 41)
$Next = GUICtrlCreateButton("Next", 264, 256, 97, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Back
        GUICtrlSetState($Pic, $GUI_HIDE)
        GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
        GUICtrlSetState($Pic, $GUI_SHOW)
        
        GUICtrlSetState($Pic, $GUI_HIDE)
        GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)
        GUICtrlSetState($Pic, $GUI_SHOW)
        
        GUICtrlSetState($Pic, $GUI_HIDE)
        GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)
        GUICtrlSetState($Pic, $GUI_SHOW)
    Case $msg = $Next
        GUICtrlSetState($Pic, $GUI_HIDE)
        GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)
        GUICtrlSetState($Pic, $GUI_SHOW)
        
        GUICtrlSetState($Pic, $GUI_HIDE)
        GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)
        GUICtrlSetState($Pic, $GUI_SHOW)
        
        GUICtrlSetState($Pic, $GUI_HIDE)
        GUICtrlCreatePic(@ScriptDir&"\4image.bmp", 8, 8, 393, 233)
        GUICtrlSetState($Pic, $GUI_SHOW)
    Case Else
    EndSelect
WEnd
Exit
:(:D Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

eh.. help? :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

eh.. help? :)

ok... try this.......... EDIT - TESTED OK!!!

#include <GUIConstants.au3>

Dim $Pick[5], $pics = 4


$Form1 = GUICreate("NextImage", 414, 305, 246, 194)
$Pick[1]= GUICtrlCreatePic(@ScriptDir&"\1image.bmp", 8, 8, 393, 233)
$Pick[2]= GUICtrlCreatePic(@ScriptDir&"\2image.bmp", 8, 8, 393, 233)
GUICtrlSetState( -1, $GUI_HIDE)
$Pick[3]= GUICtrlCreatePic(@ScriptDir&"\3image.bmp", 8, 8, 393, 233)
GUICtrlSetState( -1, $GUI_HIDE)
$Pick[4]= GUICtrlCreatePic(@ScriptDir&"\4image.bmp", 8, 8, 393, 233)
GUICtrlSetState( -1, $GUI_HIDE)
$notice = GUICtrlCreateLabel("Picture #1", 20, 258, 100, 30)
GUICtrlSetFont( -1, 15, 700)
$Back= GUICtrlCreateButton("Back", 160, 256, 97, 41)
$Next = GUICtrlCreateButton("Next", 264, 256, 97, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Back
        $set = -1
        get_pic($set)
        
    Case $msg = $Next
        $set = 1
        get_pic($set)
    Case Else
    EndSelect
WEnd
Exit


Func get_pic($t)
    For $x = 1 to $pics
        $State = GUICtrlGetState($pick[$x])
        If $State = 80 Then
        If $x = 1 And $t = -1 Then Return
        If $x = $pics And $t = 1 Then Return
        Guictrlsetstate($Pick[$x], $GUI_HIDE)
        Guictrlsetstate($Pick[$x + $set], $GUI_SHOW)
        GUICtrlSetData($notice, "Picture #" & $x + $set)
        Return
        EndIf
    Next
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

all pics in a folder

;********* USER INPUT **************
$Location = @ScriptDir & "\"
$Type = "*.bmp"   ; bmp, jpg ...whatever you want
;***********************************


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

$FileList=_FileListToArray($Location, $Type, 1) 
If (Not IsArray($FileList)) Or (@Error=1) Then
    MsgBox (0,"Sorry!","No Pictures Found.   ", 3)
    Exit
EndIf

$num = UBound($FileList) -1
Dim $Pick[$num + 1]

$Form1 = GUICreate("NextImage", 414, 305, 246, 194)
$Pick[1]= GUICtrlCreatePic($Location&$FileList[1], 8, 8, 393, 233)
for $x = 2 to $num
$Pick[$x]= GUICtrlCreatePic($Location&$FileList[$x], 8, 8, 393, 233)
GUICtrlSetState( -1, $GUI_HIDE)
Next
$notice = GUICtrlCreateLabel("Picture #1", 20, 258, 130, 30)
GUICtrlSetFont( -1, 15, 700)
$Back= GUICtrlCreateButton("Back", 160, 256, 97, 41)
$Next = GUICtrlCreateButton("Next", 264, 256, 97, 41)
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Back
        $set = -1
        get_pic($set)
        
    Case $msg = $Next
        $set = 1
        get_pic($set)
    Case Else
    EndSelect
WEnd
Exit


Func get_pic($t)
    For $x = 1 to $num
        $State = GUICtrlGetState($pick[$x])
        If $State = 80 Then
        If $x = 1 And $t = -1 Then Return
        If $x = $num And $t = 1 Then Return
        Guictrlsetstate($Pick[$x], $GUI_HIDE)
        Guictrlsetstate($Pick[$x + $set], $GUI_SHOW)
        GUICtrlSetData($notice, "Picture #" & $x + $set)
        Return
        EndIf
    Next
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Awesome! thanks val! :)

Share this post


Link to post
Share on other sites

Awesome! thanks val! :)

Welcome

8)


NEWHeader1.png

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