Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

How to use the string input of InputBox

$
0
0
I am very very new to autoit, this is my first programming language. As a starter i want to create a script with an inputbox asking the user what the SSID of a network that your trying to connect to. I want to use, what the user typed into the input field. But cant figure out how to. So far i have compiled this with no success. I also checked the help file with examples inclding the return values, which have me confused. This is what i have so far.

$answer = InputBox ( "Start Program", "This process will restart your Wireless Network Connection and start Program. Please Enter the SSID of the Wireless Network", "Type SSID Here", "", _
		 - 1, -1, 0, 0 )
If $answer == 1 Then
Run ('C:\WINDOWS\System32\cmd.exe' & " /c " & 'netsh wlan disconnect interface="Wireless Network Connection"', "", @SW_HIDE)
Sleep ( 2000 )
Run ('C:\Program Files (x86)\program.exe')
Sleep ( 10000 )
Run ('C:\WINDOWS\System32\cmd.exe' & " /c " & 'netsh wlan connect name='$answer' ssid='$answer' interface="Wireless Network Connection"', "", @SW_HIDE)
ElseIf $answer == 2 Then
ProcessClose("program.exe")
EndIf


How should i go about the first "if" statement?
I want the string of what the user put into the inputbox to run inside my cmd "netsh wlan connect" script.
Also if i were to exicute the script without '$answer' inside my cmd script. The program's windows will be in the top left hand side of the screen. I wanted to get it centered. But Any help is appriciated!

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>