Sign in to follow this  
Followers 0
Pook

Host Name input for Dummies

3 posts in this topic

Long story short: i have a script that creates a task based off the host name you input. (Easy right) We'll on of the support guys ran this script on a Production box. (Not good) I've been asked to make the script Dummy proof. All of the Production boxs start with PRO-XXXXX, and the Test boxs start with TST-XXXXXX.

My question is what does everyone think would be the best way to check if the name that was inputted doesn't start with "PRO-", and if it does I'm going to make it pop up a box saying. " Watch what your doing Dumb-A$$" =)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Local $Hostname = InputBox("Input", "Host Name")
If StringInStr($Hostname, "PRO-") Then
    MsgBox(0, "Error", "Watch what your doing Dumb-A$$ =)")
    Exit
EndIf

Keep asking until not PRO-

While 1
    If CheckInput() <> 1 Then ExitLoop
WEnd

MsgBox(0, "Success", "String not PRO-")

Func CheckInput()
    Local $Hostname = InputBox("Input", "Host Name")
    If StringInStr($Hostname, "PRO-") Then
        MsgBox(0, "Error", "Watch what your doing Dumb-A$$ =)")
        Return 1
    EndIf
    Return 0
EndFunc

Or to Restart your program:

Local $Hostname = InputBox("Input", "Host Name")
If StringInStr($Hostname, "PRO-") Then
    MsgBox(0, "Error", "Watch what your doing Dumb-A$$ =)")
    _restart()
EndIf

; Restart your program
; Author UP_NORTH

Func _restart()
    If @Compiled = 1 Then
        Run( FileGetShortName(@ScriptFullPath))
    Else
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc
Edited by rogue5099

Share this post


Link to post
Share on other sites

Thanks!!!!!!! After I update this one, I'm going to do the same thing for the rest. That way I never have to explain why something was done wrong to my director again! (I hope)

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