Jump to content
Sign in to follow this  
ksmith247

Function help

Recommended Posts

ksmith247

I have come up with a small function to check for the existance of text in an input box. If its empty, it pops up a msgbox. I am currently calling the function when a button is clicked. Everything works ok but if the input box is empty, after the warning message pops up it still executes the command. There is no damage if this hapens but I would like to prevent it.

This is my first attempt at defining my own function so if its completely jacked up please feel free to make recommendations.

Case $msg = $Button_5 ; Run Regedit
    If Not _ChkName() Then
        Run("psexec -s -i -d \\" & $ReadInput & " c:\windows\regedit.exe")
    EndIf


    
Func _ChkName()
    If $ReadInput = ("") Then
        MsgBox(4096, "Danger Will Robinson!", "Please enter a computer name")
    EndIf
EndFunc   ;==>_ChkName

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Share this post


Link to post
Share on other sites
Jos

Func _ChkName()
    If $ReadInput = ("") Then
        MsgBox(4096, "Danger Will Robinson!", "Please enter a computer name")
        Return 1
    EndIf
    Return 0
EndFunc   ;==>_ChkName


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×