jebus495 Posted October 10, 2009 Share Posted October 10, 2009 $Input1 = GUICtrlCreateInput("C:\Program Files\Diablo II\Game.exe", 8, 31, 217, 21) $d2_dir = GUICtrlRead($Input1) I need to remove the last part of this string so that all that remains is "C:\Program Files\Diablo II\" because I need to use this directory later in my script to move files to. The input will not always be "C:\Program Files\Diablo II\Game.exe" and the .exe can also change. I think I might end up needing RegExp but I'm totally lost in that crap... Link to comment Share on other sites More sharing options...
exodius Posted October 10, 2009 Share Posted October 10, 2009 It can be done pretty simply... $varExecutable = "C:\Program Files\Diablo II\Game.exe" $split = StringSplit ($varExecutable, "\") $varLocation = StringReplace ($varExecutable, "\" & $split[$split[0]], "") ;~ $Input1 = GUICtrlCreateInput($varExecutable, 8, 31, 217, 21) ;~ $d2_dir = GUICtrlRead($Input1) MsgBox (0, "", $varExecutable & @CRLF & $varLocation) Link to comment Share on other sites More sharing options...
jebus495 Posted October 10, 2009 Author Share Posted October 10, 2009 It can be done pretty simply... $varExecutable = "C:\Program Files\Diablo II\Game.exe" $split = StringSplit ($varExecutable, "\") $varLocation = StringReplace ($varExecutable, "\" & $split[$split[0]], "") ;~ $Input1 = GUICtrlCreateInput($varExecutable, 8, 31, 217, 21) ;~ $d2_dir = GUICtrlRead($Input1) MsgBox (0, "", $varExecutable & @CRLF & $varLocation) Wow TY it works perfectly! I read pretty much every string function in the helpfile spending extra time reading through StringReplace and StringSplit and just couldn't figure out how to make it do what I wanted. 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