Jump to content

Searching $input for value and errors


Digi
 Share

Recommended Posts

Hey there Guys and Girls...

First off Mass respect for the Designers and Testers of AutoIt its a Absolutely Great program... :whistle:

Now for my problem...... Prob just me being dense again...lol ;)

I have a Script I have created to help out at work, what the script does basically is gets a Servername as a Input from the user and then connects to that server gets the main server on that blade and then connects to it to run part 2 of the script...

Now on this point i need some assist, what i would like to do is this, if its possiable.

The user enters Value say GatewayServer1 and not server1 is it possiable to have a process where it searches the input value and should the first few letters = Gateway or GW it will then Bypass my process of getting the main server name and just connect and run the main process? :P

IE should $input contain GW* then run process CSDOWN, else run process Obtain server......

and i kinda need help on defining processes as well. lol...... ;) im still a N00B at this programming stuffs. :D

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Found out how to do it... So thought ill post it for prosparity :whistle:

$servername = inputbox("Servername", "Please Enter Server name")

$servername2 = stringleft($servername, 2)

passwordloop() ;This is the Function Callup for Password Authentication

if $Rpasswd <> "pies" Then

MSGbox(0, "Error", "Password incorrect Program Aborted")

Exit

Else

If $servername2 <> "GW" Then

Nogateway()

Else

gateway()

EndIf

EndIf

---------------------------------

You setup sub function by doing....

Func *function name*()

;...

EndFunc

---------------------------------

Just remember to declare your Variables as globals if you going to use them between functions....

Just add them to the start of the file

Dim @Rpasswd, $servername......... ETC...

:P I know this basic for most but like me maybe there someone that can use the info ;)

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Welcome to the forums Digi

Sorry no one answered your question... however

It seems you have found your answer

8)

Thanks Valuater

No biggy that i didnt get responce here, Peeps also busy with thier problems so i wasn't expecting the Fast reply or anything, i just happened to try something and it worked luckely, Dont worry Like i said, Im real new to this programming thing and still wanna get into it slowly, so learning as i try things... :whistle:

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

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