Queener Posted February 18, 2015 Share Posted February 18, 2015 I'm not getting what I wanted... I'm not sure if I used the And operator correctly as well. If you have other suggestion rather than using the AND operator; let me know. Here, no matter how I format, it will always run the code: ShellExecute($TV, "-i " & $keys & " --Password 9999") I tried to swapping the code: ShellExecute($TV, "-i " & $keys & " --Password " & GUICtrlRead($pwdinput)) to ShellExecute($TV, "-i " & $keys & " --Password 9999") it still execute the code with Password 9999. Here's how I use my IF and AND statement together. if GUICtrlRead($pwdinput) <> "" And GUICtrlRead($pwdinput) <> $pwlableled And GUICtrlRead($namelist) = $bArray[1] then ShellExecute($TV, "-i " & $keys & " --Password " & GUICtrlRead($pwdinput)) Else ShellExecute($TV, "-i " & $keys & " --Password 9999") EndIf Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
MikahS Posted February 18, 2015 Share Posted February 18, 2015 You'll need to post a reproducer script, as we can't test what you have created to understand what is potentially going wrong. Usually this will help you figure out what is going wrong as well. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators Solution JLogan3o13 Posted February 18, 2015 Moderators Solution Share Posted February 18, 2015 (edited) As MikahS pointed out, it is a bit irritating having to first guess at what you're doing, and then troubleshoot the problem. Workable, running code is always best. Try something like this and see if it works for you: If $pwdinput is blank, fails. If $pwdinput does not equal $pwlabeled, fails. If $pwdinput is not blank, and equals $pwlabeled, then if $namelist equals $bArray[1], succeeds. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Test", 300, 300) $pwdinput = GUICtrlCreateInput("", 10, 10, 280, 40) $namelist = GUICtrlCreateInput("", 10, 60, 280, 40) $button = GUICtrlCreateButton("Go", 10, 120, 40, 40) $pwlabeled = 1 Local $bArray[2] = ["Sue","Henry"] GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $button If GUICtrlRead($pwdinput) <> "" And GUICtrlRead($pwdinput) <> $pwlabeled Then If GUICtrlRead($namelist) = $bArray[1] Then MsgBox(0, "", "Worked") Else MsgBox(0, "", "Failed") EndIf EndSwitch WEnd GUIDelete() Edited February 18, 2015 by JLogan3o13 MikahS 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Queener Posted February 18, 2015 Author Share Posted February 18, 2015 that worked... Thanks! Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now