Jump to content

Conditional statements


lyledg
 Share

Recommended Posts

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

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...