AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FileSelectFile + SplitPath Extension return with newline

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Icarus



Joined: 24 Nov 2005
Posts: 323

PostPosted: Tue May 06, 2008 9:05 pm    Post subject: FileSelectFile + SplitPath Extension return with newline Reply with quote

Not sure if this is by design, or if it is a windows quirk, or if it is a bug.

FileSelectFile returns its result with a newline.
Now, if this is how its supposed to be, I think the SplitPath command should at least consider this.

Right now, the extension returns with a newline.

Reproduction code:
(Both MsgBoxes below will print a newline after the variable, and they shouldn't)
Code:

FileSelectFile SelectedFile, 4, %A_ScriptDir%, Select Any File, All Files (*.*)

If( ErrorLevel )
   Return
Else {
   SplitPath SelectedFile, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
   MsgBox The selected file is:`n[%SelectedFile%]
   MsgBox The extension is:`n[%OutExtension%]
}
Back to top
View user's profile Send private message Visit poster's website
Superfraggle



Joined: 02 Nov 2004
Posts: 753
Location: London, UK

PostPosted: Tue May 06, 2008 9:45 pm    Post subject: Reply with quote

Quote:
Obsolete option: In v1.0.25.06+, the multi-select option "4" is obsolete. However, for compatibility with older scripts, it still functions as it did before. Specifically, if the user selects only one file, OutputVar will contain its full path and name followed by a linefeed (`n) character. If the user selects more than one file, the format is the same as that of the M option described above, except that the last item also ends in a linefeed (`n).

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
Icarus



Joined: 24 Nov 2005
Posts: 323

PostPosted: Tue May 06, 2008 10:19 pm    Post subject: Reply with quote

Thanks.
Missed it.

Dont know why I used 4 anyway...
Still, SplitPath should remove any newlines.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group