AutoHotkey Community

It is currently May 27th, 2012, 5:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: March 16th, 2010, 6:50 am 
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..


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 6:58 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Try This
Code:
Name=i am a newbie.doc
Ext:= SubStr(Name,-3)
MsgBox %Ext%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 7:08 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
You may use SplitPath command:

Code:
InputVar = i am a newbie.doc
SplitPath, InputVar, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
MsgBox, % OutNameNoExt "`n" OutExtension


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], HotkeyStick, mrhobbeys, rbrtryn and 58 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