Sign in to follow this  
Followers 0
n9mfk9

for loop not working with gui

2 posts in this topic

here the code what it does is it runs the first time like it should

on the 2 for loop the gui box pops back up then if i MINIMIZE the gui it runs 2 to 5

what do i need to chane to keep the gui from comeing up the 2 time thanks for any help

; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

Dim $WS_OVERLAPPEDWINDOW = 0xCF0000, $WS_VISIBLE = 0x10000000, $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 392, 323,(@DesktopWidth-392)/2, (@DesktopHeight-323)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

GuiCtrlCreateLabel("Number of copies", 30, 140, 90, 30)

$Copies = GuiCtrlCreateInput("5", 130, 140, 30, 20)

GuiCtrlCreateLabel("Date", 20, 50, 80, 20)

$Date = GuiCtrlCreateDate("", 110, 50, 230, 20)

$Submit = GuiCtrlCreateButton("Submit", 150, 250, 100, 40)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Submit

ExitLoop

EndSelect

WEnd

$output = GuiRead($Date)

$Num= GuiRead($copies)

For $number = 1 To 5

WinSetState("Inbox - Outlook Express - Main Identity", "", @SW_MAXIMIZE )

WinWaitActive("Inbox - Outlook Express - Main Identity")

Send("^n")

WinWaitActive("New Message")

send("Races members "&$number)

Send("{TAB 2}")

send("Races")

WinWaitActive("Races")

send("{tab}")

$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadline($file)

If @error = -1 Then ExitLoop

$line = StringReplace($line, "date", $output )

send ($line & @cr)

Wend

FileClose($file)

send("!o")

send("b")

send("c")

send("{DOWN 8}")

send("{ENTER}")

WinSetState("Races", "", @SW_MINIMIZE )

next

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I would expect @SW_RESTORE to be used after you have used @SW_MINIMIZE ?

Edited by MHz

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