Sign in to follow this  
Followers 0
lyledg

Conditional statements

3 posts in this topic

Guys

I am trying to write a few log files based on if name fields are populated. The current code is:

$Save = GUICtrlCreateButton ("Save Log",  620, 460, 60, 25)
GLOBAL $Job = GUICtrlCreateInput ( "", 40, 40, 300, 18)
GLOBAL $SecJob = GUICtrlCreateInput ( "", 40, 125, 300, 18)
GLOBAL $ThdJob = GUICtrlCreateInput ( "", 40, 215, 300, 18)

$logfile = ($Logpath1 & (GUIread($Job)) & '.log')
$SecSrcandDstlogfile = ($Logpath1 & (GUIread($SecJob)) & '.log')
$ThdSrcandDstlogfile = ($Logpath1 & (GUIread($ThdJob)) & '.log')


$Jobchktext = GuiRead($Job) <> ""

$SecJobchktext = GuiRead($SecJob) <> ""

$ThdJobchktext = GuiRead($ThdJob) <> ""


While 1
   
  If $msg = $Save Then  
     
     
     If $Jobchktext = 1  Then   
         FileWriteline($logfile, "")
         MsgBox(262208,"Log Saved","Log file saved to " & $Logfile)
         Return
     Endif  
                 
     If $SecJobchktext = 1 Then 
         FileWriteline($SecSrcandDstlogfile, "")    
         MsgBox(262208,"Log Saved","Log file saved to " & $SecSrcandDstlogfile)
                                Return
     Endif
     
    If $ThdJobchktext = 1 Then
        FileWriteline($ThdSrcandDstlogfile, "")
        MsgBox(262208,"Log Saved","Log file saved to " & $ThdSrcandDstlogfile)
        Return
    Endif   
                
Else
  Exitloop

  EndIf
  
Wend

The code executes but only writes the first log file and NOT the rest...what am I doing wrong here? Should I be using a FOR...NEXT loop here instead?

I am wanting th write a log file for each Job name field if it is populated with text..

Any guidance would be appreciated...

:idiot:

Cheers

Share this post


Link to post
Share on other sites



as is now it seems that will make the log if

$Job, $SecJob or $ThdJob are '1' not just if they are fill in.

Maybe you meant

If $Jobchktext <> '' Then

Share this post


Link to post
Share on other sites

Thanks ezzetabi, I found the error and re-wrote the code..

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