bmw74 Posted April 28, 2009 Posted April 28, 2009 I am creating a little script to parse a CLI application. I have created a button where I can select multiple files, but when the list returns, it adds the path as the first item, followed by the first selected file as the second item, the second selected file as the third, and so on. This was taken from the Help sample: $message = "Hold down Ctrl or Shift to choose multiple files." $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 ) If @error Then MsgBox(4096,"","No File(s) chosen") Else $var = StringReplace($var, "|", @CRLF) MsgBox(4096,"","You chose " & $var) EndIfoÝ÷ Øò¢ç±yËz+b·¥·º¹ì¢g)à)¶¬bÑbêZ¶-Ñbí`¶[EW¶Ùm)^Þ^µÂ0¢é])¶b²ZÊØ^wè®fðØmçèZ0x¢¹µ.r,z[EW©jØ`·OvÑbí`¶[EW©jØ`·OvÑbí ¶[EW©jØ`·Ov×âíàµë"¯y©ky§r¶¸vÚ.±ëayìië,ÚºÚ"µÍÌÍÝHÝ[ÔXÙJ ÌÍÝ ][Ýß ][ÝË ][ÝË ][ÝÊ but it displays <path>,<file1>,<file2>, etc which doesn't really gives me what I need. Anyone knows how to do this? Sorry if this has been posted before, I did search but could not find a suitable answer, and of course the help doesn't help in this case. Thanks
Valuater Posted April 28, 2009 Posted April 28, 2009 (edited) With the quotes...? $message = "Hold down Ctrl or Shift to choose multiple files." $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4) If @error Then MsgBox(4096, "", "No File(s) chosen") Else $Split = StringSplit($var, "|") $nVar = "" For $x = 2 To $Split[0] $nVar &= "<" & $Split[1] & ">\" $nVar &= "<" & $Split[$x] & ">," Next MsgBox(4096, "", "You chose " & $nVar) EndIfoÝ÷ ØêðØhºÖ®¶sbb33c¶ÖW76vRÒgV÷C´öÆBF÷vâ7G&Â÷"6gBFò6ö÷6R×VÇFÆRfÆW2âgV÷C° ¢b33c·f"ÒfÆT÷VäFÆörb33c¶ÖW76vRÂvæF÷w4F"fײgV÷C²b3#²gV÷C²ÂgV÷C´ÖvW2¢æ§s²¢æ&×gV÷C²Â²B ¤bW'&÷"FVà¢×6t&÷CbÂgV÷C²gV÷C²ÂgV÷C´æòfÆR26÷6VâgV÷C²¤VÇ6P¢b33cµ7ÆBÒ7G&æu7ÆBb33c·f"ÂgV÷C·ÂgV÷C²¢b33c¶åf"ÒgV÷C²gV÷C°¢f÷"b33c·Ò"Fòb33cµ7ÆE³Ð¢b33c¶åf"f׳Òb33cµ7ÆE³ÒfײgV÷C²b3#²gV÷C²fײb33cµ7ÆE²b33c·ÒfײgV÷C²ÂgV÷C°¢æW@¢×6t&÷CbÂgV÷C²gV÷C²ÂgV÷Cµ÷R6÷6RgV÷C²fײb33c¶åf"¤VæD 8) Edited April 28, 2009 by Valuater
bmw74 Posted April 29, 2009 Author Posted April 29, 2009 Outstanding!! Thanks for your help Valuater!
Valuater Posted April 29, 2009 Posted April 29, 2009 Outstanding!!Thanks for your help Valuater!Welcome, glad I could help!8)
redsleeves Posted April 29, 2009 Posted April 29, 2009 Selecting a single file returned naught. So I came up with the rube goldberg code below. Is there a better or more elegant way to achieve this? Thanks Dim $Split,$nVar = "" $message = "Hold down Ctrl or Shift to choose multiple files." $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4) $Split = StringSplit($var, "|") If @error Then $Split = $var If $Split = $var Then If $Split <> "" Then MsgBox(4096,"Debug1","You chose: " & $Split) Else MsgBox(4096,"Debug2","No File(s) chosen") EndIf Else For $x = 2 To $Split[0] $nVar &= $Split[1] & "\" & $Split[$x] & "," Next MsgBox(4096, "Debug3", "You chose: " & $nVar) EndIf
Valuater Posted April 29, 2009 Posted April 29, 2009 Selecting a single file returned naught. So I came up with the rube goldberg code below. Is there a better or more elegant way to achieve this? Thanks Dim $Split,$nVar = "" $message = "Hold down Ctrl or Shift to choose multiple files." $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4) $Split = StringSplit($var, "|") If @error Then $Split = $var If $Split = $var Then If $Split <> "" Then MsgBox(4096,"Debug1","You chose: " & $Split) Else MsgBox(4096,"Debug2","No File(s) chosen") EndIf Else For $x = 2 To $Split[0] $nVar &= $Split[1] & "\" & $Split[$x] & "," Next MsgBox(4096, "Debug3", "You chose: " & $nVar) EndIf Yea! 1st Start your own thread you are not helping anyone here, this OP asked nothing about a single file chosen, that code is available in the 1st post 2nd You should not have used Dim, Use Global 3rd You should have use "Tidy Autoit Source" 4th Don't act like it's your code when you have taken the theory and most parts from another Author 8)
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