Jump to content

While (While Loop) Loop


Recommended Posts

Hi,

I tried the following codes, but those in bold isn't working properyly. pressing Yes, should copy the grc.dat file and press No should not. But in my case, pressing "No" also copies the file.

Pls assist me. thanks.

code :

$__msgbox = MsgBox(36, 'System Auto Detect', 'NAV CE Parent Server = ' & $PARENT & @LF & @LF & 'Is the network printer connected to this server?')

If ($__msgbox = 7) Then

$bLoop = 1

While $bLoop = 1

$SERVERNAME = InputBox('Specify DFS Name', 'Please specify the Server Name')

If @error = 1 Then

Exit

Else

$PRINTQ = InputBox('Specify Printer Q', 'Please specify the Printer Queue')

EndIf

If @error = 1 Then

Exit

Else

$__msgbox = MsgBox(36, 'Network Printer Queue', 'Is the path = ' & $PCNAME & ' ' & $SERVERNAME & '\' & $PRINTQ)

If ($__msgbox = 7) Then

; Do nothing and EndIf

Else

FileWriteLine("C:\Windows\Temp\printq.bat", "@echo off " & @CRLF & "addprint " & $PCNAME & " " & $SERVERNAME & "\" & $PRINTQ)

$bLoop = 0

EndIf

$__navce = MsgBox(36, "NAV CE", "Do you wish to change the Parent Server to be the same as the Printer Server?")

If ($_navce = 6) Then

FileCopy("\\" & $SERVERNAME & "\VPHome\Clt-Inst\Win32\grc.dat", "C:\Program Files\Symantec_Client_Security\Symantec AntiVirus\", 1)

Else

;Exit

EndIf

EndIf

WEnd

Else

$bLoop = 1

While $bLoop = 1

$PRINTQ = InputBox('Specify Printer Q', 'Please specify the Printer Queue')

If @error = 1 Then

Exit

Else

$__msgbox = MsgBox(36, 'Network Printer Queue', 'Is the path = ' & $PCNAME & ' ' & $PARENT & '\' & $PRINTQ)

If ($__msgbox = 7) Then

Else

FileWriteLine('C:\Windows\Temp\printq.bat', "@echo off " & @CRLF & "addprint " & $PCNAME & " " & $PARENT & "\" & $PRINTQ)

$bLoop = 0

EndIf

EndIf

WEnd

EndIf

Edited by iceberg

mouse not found....scroll any mouse to continue.

Link to comment
Share on other sites

$__navce = MsgBox(36, "NAV CE", "Do you wish to change the Parent Server to be the same as the Printer Server?")
If ($_navce = 6) Then

check your if statement your variable doesn't match the one from the msgbox

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

$__navce = MsgBox(36, "NAV CE", "Do you wish to change the Parent Server to be the same as the Printer Server?")
If ($_navce = 6) Then

check your if statement your variable doesn't match the one from the msgbox

<{POST_SNAPBACK}>

hi gafrost!

thanks for replying. why do you say the the statements do not match? spelling error? but i have already checked but the problem still persists.

or is it because i am running 2 If...EndIf statements in a WhileLoop?

pls assist me. thanks.

mouse not found....scroll any mouse to continue.

Link to comment
Share on other sites

hi gafrost!

thanks for replying. why do you say the the statements do not match? spelling error? but i have already checked but the problem still persists.

or is it because i am running 2 If...EndIf statements in a WhileLoop?

pls assist me. thanks.

<{POST_SNAPBACK}>

your return from the message box variable and then your variable in the if statement, compare the two

$__navce

$_navce

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

your return from the message box variable and then your variable in the if statement, compare the two

$__navce

$_navce

<{POST_SNAPBACK}>

hi GAFROST!!!!

thanks alot for pointing that out! how silly can i get.

it works fine now!

cheers!

mouse not found....scroll any mouse to continue.

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