ksmith247 Posted June 8, 2007 Share Posted June 8, 2007 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] Link to comment Share on other sites More sharing options...
Developers Jos Posted June 8, 2007 Developers Share Posted June 8, 2007 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 etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ksmith247 Posted June 8, 2007 Author Share Posted June 8, 2007 Once again, thank you. 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now