TrueSR Posted October 11, 2007 Posted October 11, 2007 How can i make something like this work (the $_photo &... part) : $loop = 1 For $loop = 1 To 20 Step 1 If FileExists ("\photos\" & $_startnumber & ".jpg") = 0 Then InetGet ("__website__" & $_startnumber & ".jpg", @ScriptDir & "\photos\" & $_startnumber & ".jpg") EndIf --> $_photo & (number that equals $loop) & "_s" = @ScriptDir & "\photos\" & $_startnumber & ".jpg" $_startnumber = $_startnumber + 1 $loop = $loop + 1 Next Example: $_photo1_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" Or $_photo6_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" Thank you
DW1 Posted October 11, 2007 Posted October 11, 2007 These lines do not need to be there$loop = 1oÝ÷ ØCjëh×6$loop = $loop + 1 Besides that, im not sure what you are wanting AutoIt3 Online Help
Nahuel Posted October 11, 2007 Posted October 11, 2007 Mmmm... I don't understand either.. could you be a bit more specific? Besides what danwilli said, I believe that "number that equals $loop" is just.. $loop
TrueSR Posted October 12, 2007 Author Posted October 12, 2007 Well, i have a GUI with 20 pictures but when u click a next button, the pictures need to change. I can already give you a part of my script, but it's not done yet. I made the script smaller, only 5 pictures in this 1. And i still need a Next button, but i will add this later. This is how i do it for now, but is it possible to make the function smaller ? expandcollapse popup#include <GUIConstants.au3> Global $_photo1_s="", $_photo2_s="", $_photo3_s="", $_photo4_s="", $_photo5_s="" setphoto(1) ; Main GUI $maingui = GUICreate ("Photo Album", 660, 600) $photo1_s = GUICtrlCreatePic ($_photo1_s, 10, 10, 120, 120) $photo2_s = GUICtrlCreatePic ($_photo2_s, 140, 10, 120, 120) $photo3_s = GUICtrlCreatePic ($_photo3_s, 270, 10, 120, 120) $photo4_s = GUICtrlCreatePic ($_photo4_s, 400, 10, 120, 120) $photo5_s = GUICtrlCreatePic ($_photo5_s, 530, 10, 120, 120) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd ; This is how i do it for now : Func setphoto($_startnumber) DirGetSize (@ScriptDir & "\photos") If @error = 1 Then DirCreate (@ScriptDir & "\photos") EndIf ; Picture by picture If FileExists ("\photos\" & $_startnumber & ".jpg") = 0 Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $_startnumber & ".jpg", @ScriptDir & "\photos\" & $_startnumber & ".jpg") EndIf $_photo1_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" $_startnumber = $_startnumber + 1 If FileExists ("\photos\" & $_startnumber & ".jpg") = 0 Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $_startnumber & ".jpg", @ScriptDir & "\photos\" & $_startnumber & ".jpg") EndIf $_photo2_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" $_startnumber = $_startnumber + 1 If FileExists ("\photos\" & $_startnumber & ".jpg") = 0 Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $_startnumber & ".jpg", @ScriptDir & "\photos\" & $_startnumber & ".jpg") EndIf $_photo3_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" $_startnumber = $_startnumber + 1 If FileExists ("\photos\" & $_startnumber & ".jpg") = 0 Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $_startnumber & ".jpg", @ScriptDir & "\photos\" & $_startnumber & ".jpg") EndIf $_photo4_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" $_startnumber = $_startnumber + 1 If FileExists ("\photos\" & $_startnumber & ".jpg") = 0 Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $_startnumber & ".jpg", @ScriptDir & "\photos\" & $_startnumber & ".jpg") EndIf $_photo5_s = @ScriptDir & "\photos\" & $_startnumber & ".jpg" $_startnumber = $_startnumber + 1 EndFunc I hope u can help me now, Thanks already
weaponx Posted October 12, 2007 Posted October 12, 2007 expandcollapse popup#include <GUIConstants.au3> Global $_photo[5] Global $photoDir = @ScriptDir & "\photos\" setphoto(1) ; Main GUI $maingui = GUICreate ("Photo Album", 660, 600) GUISetState (@SW_SHOW) $photo1_s = GUICtrlCreatePic ($_photo[0], 10, 10, 120, 120) $photo2_s = GUICtrlCreatePic ($_photo[1], 140, 10, 120, 120) $photo3_s = GUICtrlCreatePic ($_photo[2], 270, 10, 120, 120) $photo4_s = GUICtrlCreatePic ($_photo[3], 400, 10, 120, 120) $photo5_s = GUICtrlCreatePic ($_photo[4], 530, 10, 120, 120) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; This is how i do it for now : Func setphoto($_startnumber) DirCreate (@ScriptDir & "\photos") For $X = 1 to Ubound($_photo) ; Picture by picture If NOT FileExists ($photoDir & $X & ".jpg")Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $X & ".jpg", $photoDir & $X & ".jpg") EndIf $_photo[$X - 1] = $photoDir & $X & ".jpg" Next EndFunc
TrueSR Posted October 13, 2007 Author Posted October 13, 2007 expandcollapse popup#include <GUIConstants.au3> Global $_photo[5] Global $photoDir = @ScriptDir & "\photos\" setphoto(1) ; Main GUI $maingui = GUICreate ("Photo Album", 660, 600) GUISetState (@SW_SHOW) $photo1_s = GUICtrlCreatePic ($_photo[0], 10, 10, 120, 120) $photo2_s = GUICtrlCreatePic ($_photo[1], 140, 10, 120, 120) $photo3_s = GUICtrlCreatePic ($_photo[2], 270, 10, 120, 120) $photo4_s = GUICtrlCreatePic ($_photo[3], 400, 10, 120, 120) $photo5_s = GUICtrlCreatePic ($_photo[4], 530, 10, 120, 120) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; This is how i do it for now : Func setphoto($_startnumber) DirCreate (@ScriptDir & "\photos") For $X = 1 to Ubound($_photo) ; Picture by picture If NOT FileExists ($photoDir & $X & ".jpg")Then InetGet ("http://users.skynet.be/jochem/Photo_Album/photos/" & $X & ".jpg", $photoDir & $X & ".jpg") EndIf $_photo[$X - 1] = $photoDir & $X & ".jpg" Next EndFunc Thank u very much
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