Jump to content

Anyway To Recreate This Loop?


Recommended Posts

I'd give you the rest of the GUI but it would contain alot of useless stuff. I'd like to eliminate the If - EndIf and have just one line if possible.

Dim $Image[5]
$Image[1] = 'G:\Packaging\Labels\Sato8400\Production\unit\136041.prv'
$Image[2] = 'H:\Main Dump (Everything to be sorted out)\Labels\1190 unit label.prv'
$Image[3] = 'H:\Main Dump (Everything to be sorted out)\Labels\Jag Date Code Automation.prv'
$Image[4] = 'H:\Main Dump (Everything to be sorted out)\Labels\Bulk ESD.prv'

Dim $PI[5]
$Pic_W = @DesktopWidth/4-40
;~ $PI[1]=GUICtrlCreatePic($Image[1],30,500, $Pic_W,150)
;~ $PI[2]=GUICtrlCreatePic($Image[2],$Pic_W+60,500, $Pic_W,150)
;~ $PI[3]=GUICtrlCreatePic($Image[3],$Pic_W+$Pic_W+90,500, $Pic_W,150)
;~ $PI[4]=GUICtrlCreatePic($Image[4],$Pic_W+$Pic_W+$Pic_W+120,500, $Pic_W,150)
For $i = 1 To 4
    If $i = 1 Then
        $PI[$i]=GUICtrlCreatePic($Image[$i],30*$i,500, $Pic_W,150)
    Else
        $PI[$i]=GUICtrlCreatePic($Image[$i],$Pic_W * ($i - 1) + (30 * $i),500, $Pic_W,150)
    EndIf
Next

EDIT: I need the Controls evenly spaced out like the commented part shows.

Edited by strate
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

I'd give you the rest of the GUI but it would contain alot of useless stuff. I'd like to eliminate the If - EndIf and have just one line if possible.

Dim $Image[5]
$Image[1] = 'G:\Packaging\Labels\Sato8400\Production\unit\136041.prv'
$Image[2] = 'H:\Main Dump (Everything to be sorted out)\Labels\1190 unit label.prv'
$Image[3] = 'H:\Main Dump (Everything to be sorted out)\Labels\Jag Date Code Automation.prv'
$Image[4] = 'H:\Main Dump (Everything to be sorted out)\Labels\Bulk ESD.prv'

Dim $PI[5]
$Pic_W = @DesktopWidth/4-40
;~ $PI[1]=GUICtrlCreatePic($Image[1],30,500, $Pic_W,150)
;~ $PI[2]=GUICtrlCreatePic($Image[2],$Pic_W+60,500, $Pic_W,150)
;~ $PI[3]=GUICtrlCreatePic($Image[3],$Pic_W+$Pic_W+90,500, $Pic_W,150)
;~ $PI[4]=GUICtrlCreatePic($Image[4],$Pic_W+$Pic_W+$Pic_W+120,500, $Pic_W,150)
For $i = 1 To 4
    If $i = 1 Then
        $PI[$i]=GUICtrlCreatePic($Image[$i],30*$i,500, $Pic_W,150)
    Else
        $PI[$i]=GUICtrlCreatePic($Image[$i],$Pic_W * ($i - 1) + (30 * $i),500, $Pic_W,150)
    EndIf
Next

EDIT: I need the Controls evenly spaced out like the commented part shows.

How about:

Dim $PI[5]
$Pic_W = @DesktopWidth/4-40
For $i = 1 To 4
    $PI[$i]=GUICtrlCreatePic($Image[$i],$Pic_W * ($i - 1) + (30 * $i),500, $Pic_W,150)
Next

:think:

Edit: Didn't need that seperate line for $i = 1 anyway...

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

How about:

Dim $PI[5]
$Pic_W = @DesktopWidth/4-40
For $i = 1 To 4
    $PI[$i]=GUICtrlCreatePic($Image[$i],$Pic_W * ($i - 1) + (30 * $i),500, $Pic_W,150)
Next

:think:

Edit: Didn't need that seperate line for $i = 1 anyway...

Wow, that makes me feel like an idiot, thanks a ton.
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
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
 Share

  • Recently Browsing   0 members

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