Sign in to follow this  
Followers 0
Sean M

New and I have a question

3 posts in this topic

Hello I am new to AutoIt and I have a question. this program is used to open up IIS and to add a Virtual Directory to it. I am having trouble when I want to verify that there is text in the inputbox. I added an If Then statement into the code but it is not working. Thanks in advance

#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 328, 173, 192, 125)
$Input1 = GUICtrlCreateInput("", 32, 56, 169, 21)
$Input2 = GUICtrlCreateInput("",32, 20, 169, 21)
$Button1 = GUICtrlCreateButton("Browse", 224, 56, 57, 25, 0)
$Button2 = GUICtrlCreateButton("Next", 100,100)
$Button3 = guictrlcreatebutton("Clear", 50,100)


GUISetState(@SW_SHOW)


While 1
    $msg = GuiGetMsg()
    
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        $select = FileSelectFolder( "Select File","")
        ControlSetText( "", "", $Input1, $select)
        
    Case $msg = $Button2 
        If $Input2 = ("") Then  
            msgbox(4096,"","No Entry")
        Else
            Send("#r") 
            Send("inetmgr")
            Send("{ENTER}")
            WinWaitActive("Internet Information Services")
            Send("{Right}")
            Send("{Right}")
            Send("{Right}")
            Send("{Right}")
            Send("{Right}")
            Send("!a")
            Send("n")
            Send("v")
            Winwaitactive("Virtual Directory Creation Wizard","Welcome to the Virtual Directory Creation Wizard")
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","Virtual Directory Alias")
            $alias = GUICtrlRead($Input2)
            Send($alias)
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","Web Site Content Directory")
            Send($select)
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","Access Permissions")
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","You have successfully completed the Virtual Directory Creation Wizard.")
            Send("{ENTER}")
        EndIf
    ;;;;;;;
EndSelect

WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 328, 173, 192, 125)
$Input1 = GUICtrlCreateInput("", 32, 56, 169, 21)
$Input2 = GUICtrlCreateInput("",32, 20, 169, 21)
$Button1 = GUICtrlCreateButton("Browse", 224, 56, 57, 25, 0)
$Button2 = GUICtrlCreateButton("Next", 100,100)
$Button3 = guictrlcreatebutton("Clear", 50,100)


GUISetState(@SW_SHOW)


While 1
    $msg = GuiGetMsg()
   
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        $select = FileSelectFolder( "Select File","")

        ControlSetText( "", "", $Input1, $select)
       
    Case $msg = $Button2
        $Read = GUICtrlRead($Input2)
        $Input3 = StringReplace($Read, "|", @CRLF)
        If $Input3 = "" Then 
            msgbox(4096,"","No Entry")
        Else
            Send("#r")
            Send("inetmgr")
            Send("{ENTER}")
            WinWaitActive("Internet Information Services")
            Send("{Right}")
            Send("{Right}")
            Send("{Right}")
            Send("{Right}")
            Send("{Right}")
            Send("!a")
            Send("n")
            Send("v")
            Winwaitactive("Virtual Directory Creation Wizard","Welcome to the Virtual Directory Creation Wizard")
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","Virtual Directory Alias")
            $alias = GUICtrlRead($Input2)
    $alias2 = StringReplace($alias, "|", @CRLF)
            Send($alias2)
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","Web Site Content Directory")
            Send($select)
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","Access Permissions")
            Send("!n")
            WinWaitActive("Virtual Directory Creation Wizard","You have successfully completed the Virtual Directory Creation Wizard.")
            Send("{ENTER}")
        EndIf
    ;;;;;;;
EndSelect

WEnd
 oÝ÷ ص©òÁ¬¬ü¨»])¶z!jܨº¯zØ^­íý²Ê&z¥¥¦è½à%*.ÁêÞ+,x0jÆ®¶­s`¢b33cµ&VBÒuT7G&Å&VBb33c´çWC" b33c´çWC2Ò7G&æu&WÆ6Rb33cµ&VBÂgV÷C·ÂgV÷C²Â5$Äb bb33c´çWC2ÒgV÷C²gV÷C²FVâ¢×6v&÷CbÂgV÷C²gV÷C²ÂgV÷C´æòVçG'gV÷C² ¢b33c¶Æ2ÒuT7G&Å&VBb33c´çWC" b33c¶Æ3"Ò7G&æu&WÆ6Rb33c¶Æ2ÂgV÷C·ÂgV÷C²Â5$Äb¢6VæBb33c¶Æ3"

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites

Thanks to you both

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