|
|
|||||||
Hello I have some remote users that sometimes need to change their IP Address. I would like to create a script like this: messagebox "What is the IP given by your hotel" ----> OK for me A popup arrive and the user can give this ip address. ----> NOT OK for me After Registry modification with this parameters ----> OK for me Somebody has an idea? Many thanks Eric |
||||||||
|
|
|||||||
so, you have everything set except the popup asking for the IP? |
||||||||
|
|
|||||||
Excactly I don't know how to have a popup that allow user to enter his given IP That's it |
||||||||
|
|
|||||||
You can use the Gets command for this. If you want a nice popup window then KiXforms might be an option. KiXforms website Code: Break on ?"Please enter your IP address: " Gets $rc ? $rc Sleep 5 |
||||||||
|
|
|||||||
Yes, but be aware that using Kixforms will require that the DLL be registered on every computer. Maybe not so bad if it's just for a handful of laptops.. Glenn |
||||||||
|
|
|||||||
Sorry, deleted my post, was against my principles :-) |
||||||||
|
|
|||||||
Thank god for RSS feeds Suggesting VBS......shame on you Arend |
||||||||
|
|
|||||||
Many thanks for your answers guys... I have already create a script who will change network configuration (via netsh command). But I would that user receives a popup to entrer his provider IP (if not DHCP, and that this IP is wrotten inside my netsh script, afterwards this netsh script is excecuted. I hope this can help you Eric |
||||||||
|
|
|||||||
There is no native method in Kix - you'll need to use KixForms, which requires the registration of a DLL on every computer, or use some built-in capability such as that language that contains a "V" and a "B", as Arend was struggling to say. Maybe a future feature request?? PromptBox() - similar syntax to MessageBox(), but instead of buttons, it has a one-line input field and it returns that string. Just an OK/Cancel button, where Enter/OK return the string, and Cancel retuns nothing. Glenn |
||||||||
|
|
|||||||
Glenn, just InputBox() like the "V" program has will do Originally Posted By: Mart Thank god for RSS feeds Suggesting VBS......shame on you Arend Yeah I know, sometimes I'm too eager to help |
||||||||
|
|
|||||||
Originally Posted By: apronk Glenn, just InputBox() like the "V" program has will do I'll take your word for it, but you get the idea - a simple GUI box to prompt for and accept a line of input text. Glenn PS - I only use VBS on the web server, and even there, usually use it to feed Kix scripts on the back end. No need for popup dialogs there.. |
||||||||
|
|
|||||||
Pay no attention to how it gets done... just that it does |
||||||||
|
|
|||||||
I think we can simplify that a bit: Code: $IP=InputBox("Enter IP Address") $=MessageBox("You entered: '"+$IP+"'","Result") Function InputBox($sPrompt,Optional $sTitle,$sDefaultValue) Dim $sc, $result $sc = CreateObject("ScriptControl") $sc.Language = "vbscript" $result = $sc.Eval('Inputbox("' + $sPrompt + '","' + $sTitle + '","' + $sDefaultValue + '")') $sc = 0 $InputBox = $result EndFunction |
||||||||
|
|
|||||||
Sweet, guys! With the MessageBox in Richard's example, the result looks just as annoying as if it were written in wscript! (sorry, I've dealt with too many poorly written wscripts that output 100+ messages, one msgbox at a time, and do so in such a way that you can't terminate the process.) Still, I'll be adding this to the UDF library for those special situations, and pretend it has nothing to do with that "V" thingy.. Glenn |
||||||||
|
|
|||||||
"ScriptControl" - Where does he find all these wonderful toys? (Spoken like Joker in the first Batman movie) That's a new one to me. On my list to find out more. |
||||||||
|
|
|||||||
Originally Posted By: Allen "ScriptControl" - Where does he find all these wonderful toys? (Spoken like Joker in the first Batman movie) That's a new one to me. On my list to find out more. Found right here on this board It came as a surprise to me too when it appeared recently in this post: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Board=8&Number=196767 |
||||||||
|
|
|||||||
I saw that thread, but completely missed what/how it was working. This is a neat idea. Definitely keeping this option open for other things. Glad you saw it. MSDN Documentation: http://msdn.microsoft.com/en-us/library/aa227413%28VS.60%29.aspx Based on a few searches .language is supposed to default to vbscript but removing that line breaks the script. A little more cleanup Code: Function InputBox($sPrompt,Optional $sTitle,$sDefaultValue) Dim $sc $sc = CreateObject("ScriptControl") $sc.language = "VBScript" $inputbox = $sc.Eval('Inputbox("' + $sPrompt + '","' + $sTitle + '","' + $sDefaultValue + '")') EndFunction |
||||||||
|
|
|||||||
Hi everybody Many thanks for all your answer. Sorry for the delay of mine. As I have seen, a suggestion is to use VBS, but I would like to stay with Kix. I will try to use inputbox from kixforms. It is not a problem for me to install dlls (autoIt) I will give feed back to you when I find the time to test it Many thanks again Eric |
||||||||
|
|
|||||||
The InputBox() UDF posted above can be used directly in KiXtart, it just borrows the function from VBS. |
||||||||
|
|
|||||||
Originally Posted By: Allen "ScriptControl" - Where does he find all these wonderful toys? (Spoken like Joker in the first Batman movie) That's a new one to me. On my list to find out more. What Allen said! ScriptControl... Why haven't I found this one before!!!! |
||||||||
|
|
|||||||
In that fashion, at long last: Code: Function IsNumeric($strInput) Dim $sc, $rc $sc = CreateObject("ScriptControl") $sc.Language = "VBScript" $rc=$sc.Eval('IsNumeric("'+$strInput+'")') If $rc = -1 $IsNumeric = 1 Else $IsNumeric = 0 EndIf EndFunction |
||||||||
|
|
|||||||
Originally Posted By: Richard H. The InputBox() UDF posted above can be used directly in KiXtart, it just borrows the function from VBS. I posted it in the UDF section. This is too useful to get "lost" in the post history. At least now it is easy to find. Thanks Richard and Allen for providing the code. UDF Library » InputBox() - Displays an inputpox and gets the result |