Guest yeahns Posted March 17, 2004 Share Posted March 17, 2004 Hi! I'm having trouble with a piece of code where I want the user to name a folder and pick a place to put the folder. It looks like this: $var2 = InputBox("", "Folder name", "", "", 200, 125) $var1 = FileSelectFolder("", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0) MsgBox(4096,"", $var1 & "\" & $var2) DirCreate($var1 & "\" & $var2) Run("Explorer.exe " & $var1 & "\" & $var2) Exit It works fine as long as you put the folder the user named in a sub-folder on the drive, like D:\subfolder, but when the user puts the folder directly on D:\ then I get D:\\ and the "Run("Explorer.exe " & $var1 & "\" & $var2)" does not open the recently created folder. I'm probably doing a silly mistake but what would be the best way to solve this since I don't know if the user is gonna to put in a subfolder or directly on a drive? Greatful for any help Kind regards Jens Link to comment Share on other sites More sharing options...
Developers Jos Posted March 17, 2004 Developers Share Posted March 17, 2004 jens, you could test if the $var1 ends with a \ and then remove it... like this: $var2 = InputBox("", "Folder name", "", "", 200, 125) $var1 = FileSelectFolder("", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0) if StringRight($var1,1) = "\" then $var1=StringTrimRight($var1,1) MsgBox(4096,"", $var1 & "\" & $var2) DirCreate($var1 & "\" & $var2) Run("Explorer.exe " & $var1 & "\" & $var2) Exit 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...
Guest yeahns Posted March 18, 2004 Share Posted March 18, 2004 Excellent! I was looking for parameters in the Run command that could handle the problem, but using trim takes care of it. Tank you JdeB! 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