AutoitNew94 Posted March 10, 2011 Share Posted March 10, 2011 (edited) This does not work. How do I fix this #Include <String.au3> $ParsedStr = _StringBetween($CmdLineRaw, "", " ") If $ParsedStr[0] > 0 Then For $i = 1 To $ParsedStr[0] ConsoleWrite($ParsedStr[$i]) Next EndIf Thank You- Edited March 10, 2011 by AutoitNew94 "You're not smart enough for me to open my inbox, so stop sending me mail." Link to comment Share on other sites More sharing options...
Logty Posted March 10, 2011 Share Posted March 10, 2011 This does not work. #Include <String.au3> $CmdStr = $CmdLineRaw $ParsedStr = _StringBetween($CmdStr, "", " ") If $ParsedStr[0] > 0 Then For $i = 1 To $ParsedStr[0] ConsoleWrite($ParsedStr[$i] & @LF) Next EndIf Thank You- Here, try this #Include <String.au3> $CmdStr = $CmdLineRaw $ParsedStr = StringSplit($CmdStr, " ") If $ParsedStr[0] > 1 Then For $i = 1 To $ParsedStr[0] ConsoleWrite($ParsedStr[$i] & @LF) Next EndIf Is that what you were looking for? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 10, 2011 Moderators Share Posted March 10, 2011 AutoitNew94,I think it is doing exactly what I would expect when I put a space-delimited string as $CmdLineRaw. What do you expect it to do? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AutoitNew94 Posted March 10, 2011 Author Share Posted March 10, 2011 Here, try this #Include <String.au3> $CmdStr = $CmdLineRaw $ParsedStr = StringSplit($CmdStr, " ") If $ParsedStr[0] > 1 Then For $i = 1 To $ParsedStr[0] ConsoleWrite($ParsedStr[$i] & @LF) Next EndIf Is that what you were looking for? No this does not work. I get a compile error. "You're not smart enough for me to open my inbox, so stop sending me mail." Link to comment Share on other sites More sharing options...
AutoitNew94 Posted March 10, 2011 Author Share Posted March 10, 2011 AutoitNew94,I think it is doing exactly what I would expect when I put a space-delimited string as $CmdLineRaw. What do you expect it to do? M23I get no output to the command window.I compile as console app I'm on x64 so I doall that still no output.My original script after compiled and ran from the command promptlike.C:\>MyScript.exe Hello World This is a TestProduces not output. "You're not smart enough for me to open my inbox, so stop sending me mail." Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 10, 2011 Moderators Share Posted March 10, 2011 AutoitNew94,I too get no output when I run it with a preset variable in SciTE or as a compiled exe with a real command line - and as I said earlier I would not expect to either. Let me explain why:Firstly you are asking _StringBetween to give you what is between the beginning of the file and a space, so you will only ever get the first parameter returned. Secondly you have obviously not read the Help file about how _StringBetween returns its values. It does not return a count in the [0] element - that is the first return. So your loop never runs and you do not get even the first parameter to display on the console. So how could you do it? Logty gave you the answer - use StringSplit. This runs for me in SciTE and (if I comment out the $CmdLineRaw declaration) as a compiled CUI with a set of parameters:$CmdLineRaw = "1 2 3" $ParsedStr = StringSplit($CmdLineRaw, " ") If $ParsedStr[0] > 0 Then For $i = 1 To $ParsedStr[0] ConsoleWrite($ParsedStr[$i] & @CRLF) Next EndIfAll clear? M23P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AutoitNew94 Posted March 10, 2011 Author Share Posted March 10, 2011 Thank you very much for your assistance on my question as well as proper format on the form. With a little modification the code now does what I want it to. $ParsedStr = StringSplit($CmdLineRaw, " ", 0) If $ParsedStr[0] > 0 Then For $i = 1 To $ParsedStr[0] ConsoleWrite($ParsedStr[$i] & " ") Next EndIf Thank You- "You're not smart enough for me to open my inbox, so stop sending me mail." 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