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 

String Manipulation

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



Joined: 27 Dec 2005
Posts: 3

PostPosted: Fri Jan 06, 2006 9:59 am    Post subject: String Manipulation Reply with quote

I'm referencing %A_LoopFileName% in the statement below:

WinMenuSelectItem,%A_LoopFileName%,,File,Export As MP3...

But I want to use the filename without the extension.

I know I can assign the fullname to a variable like this:

myFileName = %A_LoopFileName%

But how do I remove the last extension from the end? I can't seem to find the string manipulation functions in the documentation.

Once I have the right value in my variable.

Do I simply use it like this:
WinMenuSelectItem,myFileName,,File,Export As MP3...

Thanks.
Back to top
View user's profile Send private message
Rabiator



Joined: 17 Apr 2005
Posts: 265
Location: Sauerland

PostPosted: Fri Jan 06, 2006 11:01 am    Post subject: Re: String Manipulation Reply with quote

Quote:
But I want to use the filename without the extension.
You can extract it with SplitPath.
Back to top
View user's profile Send private message
JSLover



Joined: 20 Dec 2004
Posts: 542
Location: LooseChange911.com... the WTC attacks were done by the US Gov't... the official story is a lie...

PostPosted: Fri Jan 06, 2006 12:19 pm    Post subject: Re: String Manipulation Reply with quote

slken wrote:
I'm referencing %A_LoopFileName% in the statement below:

WinMenuSelectItem,%A_LoopFileName%,,File,Export As MP3...
slken wrote:
Do I simply use it like this:
WinMenuSelectItem,myFileName,,File,Export As MP3...

...now why would you use %'s (percents) on A_LoopFileName but not on myFileName?...you wouldn't! If one variable uses %'s then so does the other...(if one doesn't, neither does the other {in the case of expressions}).

SplitPath wrote:
SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]
Code:
SplitPath, A_LoopFileName, , , , A_LoopFileNameNoExt

_________________

Home • Click image! • Blog
Back to top
View user's profile Send private message Visit poster's website
Decarlo110



Joined: 15 Dec 2004
Posts: 303
Location: United States

PostPosted: Fri Jan 06, 2006 4:30 pm    Post subject: Reply with quote

Quote:
how do I remove the last extension from the end?

Presuming the extension is 3 chars long plus the dot, you could use:
Code:
StringTrimRight, A_LoopFileName_Trimmed, A_LoopFileName, 4

The String manipulation functions can be found in Helpfile > Index > String__
and online at Alphabetical Command Reference
and in Helpfile > Contents > String Management.
_________________
1) The Open Source Definition http://www.opensource.org/docs/definition_plain.php

2) Intuitive. Logical. Versatile. Adaptable. <<AutoHotkey>>
Back to top
View user's profile Send private message
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