igorm Posted September 24, 2007 Share Posted September 24, 2007 Hi. I need a little help. I created one small application with few inputboxes, but I need to force user to enter the path to the folder (not to file). It would be good if I could display message to user if he/she did not enter the path. Can somebody help me with this please? Tnx in advance for help. Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
Nahuel Posted September 24, 2007 Share Posted September 24, 2007 Maybe it'd be better if you used FileSelectFolder. It does what you want. Link to comment Share on other sites More sharing options...
JBeef Posted September 24, 2007 Share Posted September 24, 2007 $answer = "" While $answer = "" $answer = InputBox("stupid","question") If @error = 1 Then DoCancel() If @error = 2 Then DoTimeout() If @error = 3 Then DoInputFailed() WEnd you minus @errors if wanted. ~Jap Link to comment Share on other sites More sharing options...
anixon Posted September 24, 2007 Share Posted September 24, 2007 (edited) Hi.I need a little help. I created one small application with few inputboxes, but I need to force user to enter the path to the folder (not to file). It would be good if I could display message to user if he/she did not enter the path. Can somebody help me with this please?Tnx in advance for help.Cheers The solution you require for this is probably tooltips the following is an example:$ExitButton = GUICtrlCreateIcon("shell32.dll", 240, 450, 240, 40, 35)GUICtrlSetTip(-1, " Exit", "Help", 1, 1)In this example the reference to shell32.dll,240 determines what the control look like in the case a fancy X. The control itself can be an inputbox or a button or any of the other types. When the mouse pointer floats over the control then the tip is displayed in a message box. In the case the message is "Exit" it can be whatever you would like it to be you can use @crlf or @ lf to start text on new lines in the box this is an exampleGUICtrlSetTip(-1, " Exit" & @crlf & @lf & "This is the additional message", "Help", 1, 1)The input error trap would be accommodated in the control routine$inputbox1 = GUICtrlRead($nameforinputbox) ;read the inputWhile 1$msg = GUIGetMsg()SelectCase $msg = $GUI_EVENT_CLOSE Or $msg = $ExitButtonGUIDelete()ExitCase $msg = "nameofyourinputbox""perform the input test based on if and or then"EndselectWendHope that this gets you goingCheersAnt.. Edited September 24, 2007 by anixon Link to comment Share on other sites More sharing options...
igorm Posted September 24, 2007 Author Share Posted September 24, 2007 Thank you for help, but it is not what I need. It seems that I did not explain quite well. I have two inputboxes. One is for folder browsing (I used FileSelectFolder). Second one is for selecting files (I used FileOpenDialog) And I have one button which will execute something. But execution will fail if first inputbox is empty. So when user press button for execute and first inputbox is empty I need to display message that path is not entered and to stop execution activated by pressing button. Hope you can help me now. Thanks again. Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
qazwsx Posted September 24, 2007 Share Posted September 24, 2007 read the text of the input box, and if that is "" then do something to stop the script or tell them it is empty. Link to comment Share on other sites More sharing options...
Nahuel Posted September 24, 2007 Share Posted September 24, 2007 $folderimput=GUictrlcreateedit(blah blah) *button is pressed* If Guictrlread($folderimput)="" Then MsgBox(0,"","You must enter a path") Endif Link to comment Share on other sites More sharing options...
qazwsx Posted September 24, 2007 Share Posted September 24, 2007 Then you would hvae to put the rest of your script in an else part of that if to keep it from running. eg: If Guictrlread($folderimput)="" Then MsgBox(0,"","You must enter a path") Else Rest of code Endif End of loop Link to comment Share on other sites More sharing options...
Demonic Posted September 24, 2007 Share Posted September 24, 2007 Nother way, if your using Funcs for each Q Func questionOne() $questionOneAns = Inputbox("Q1", "q1") If $questionOneAns <> "" questionTwo() Else MsgBox("Fail", "Failed to enter a directory") questionOne() EndFunc then repeat the func for the 2nd question, modifying as needed. Link to comment Share on other sites More sharing options...
igorm Posted September 24, 2007 Author Share Posted September 24, 2007 (edited) Thank you guys. It works now. You are the best. Cheers Edited September 24, 2007 by igorm Office 2000/XP/2003/2007 Slipstreamer 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