AutoHotkey Community

It is currently May 27th, 2012, 6:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: String Manipulation
PostPosted: January 6th, 2006, 9:59 am 
Offline

Joined: December 27th, 2005, 1:25 am
Posts: 3
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: String Manipulation
PostPosted: January 6th, 2006, 11:01 am 
Offline

Joined: April 17th, 2005, 7:47 pm
Posts: 289
Location: Sauerland
Quote:
But I want to use the filename without the extension.
You can extract it with SplitPath.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: String Manipulation
PostPosted: January 6th, 2006, 12:19 pm 
Offline
User avatar

Joined: December 20th, 2004, 12:19 pm
Posts: 798
Location: LooseChange911.com Ask Questions, Demand Answers █ The WTC bldgs █ shouldn't have fallen █ that fast
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

_________________
AutoHotkey-Hotstring.ahk - Helping the world spell "AutoHotkey" correctly! (btw, it's a lowercase k!)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2006, 4:30 pm 
Offline

Joined: December 15th, 2004, 10:24 pm
Posts: 303
Location: United States
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>>


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], hd0202 and 56 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group