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 

trying to use StringSplit

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ahk_noob
Guest





PostPosted: Tue Mar 16, 2010 5:50 am    Post subject: trying to use StringSplit Reply with quote

Hi all..
I was trying to use stringsplit command to a particular file name.
like for example

Quote:
i am a newbie.doc


I wish to rename this file but I have to keep the extension..
i tried using split path to store .doc into a variable.. but seems like it doesnt work for me..
I tried this:

Code:
name=i am a newbie.doc
         stringsplit,word_array,name,.,


i tried to display out the word_array but seems like it doesn work. I got to display out word by word. for example word_array4.

May I know how can I save the .doc into a variable?
thanks for the help as i am really new to AHK..
Back to top
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Tue Mar 16, 2010 5:58 am    Post subject: Reply with quote

Try This
Code:
Name=i am a newbie.doc
Ext:= SubStr(Name,-3)
MsgBox %Ext%
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Mar 16, 2010 6:08 am    Post subject: Reply with quote

You may use SplitPath command:

Code:
InputVar = i am a newbie.doc
SplitPath, InputVar, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
MsgBox, % OutNameNoExt "`n" OutExtension
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
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