Help! File extensions

Friday, June 22, 2007 by sViz | Discussion: DesktopX

I do believe I'm losing my mind.

Please apply the following code to an object:



'Called when files are dropped onto object
Sub Object_OnDropFiles(files)
strExtension = Right(files,Len(files)-InStrRev(files,"."))
msgbox strExtension
msgbox Len(strExtension)
End Sub


Now, drag and drop an image file onto it.

The first msgbox should show the file extension. The second msgbox should show how many characters are in the extension.

EDIT:

Only one problem: The number of characters is 4 instead of 3.

sViz
Reply #1 Friday, June 22, 2007 8:13 PM
  Nevermind. I created a solution.
RomanDA
Reply #2 Friday, June 22, 2007 8:48 PM
glad we could all help
sViz
Reply #3 Friday, June 22, 2007 11:18 PM
Heh.  
Bichur
Reply #4 Saturday, June 23, 2007 12:13 AM
crap. I didn't know the answer....


you guys rock
SirSmiley
Reply #5 Saturday, June 23, 2007 2:21 PM
Was the answer using the GetExtensionName Method?
sViz
Reply #6 Sunday, June 24, 2007 1:04 AM
 Where were you when I was pulling my hair out over this?! GetExtensionName works better. Can't believe I didn't find this when I was googling about. Thanks, SirS.

Now, is there a GetMyHairBack Method or am I stuck sporting the Britney look?  
bilbo1930
Reply #7 Sunday, June 24, 2007 1:57 AM
Now, is there a GetMyHairBack Method or am I stuck sporting the Britney look?



SirSmiley
Reply #8 Sunday, June 24, 2007 4:17 PM
The only reason I knew it was from the Shortcut Parsing script. Plus I read up in the Windows Script Resource about it. I always find the best search terms are vbscript+FileSystemObject+find file extension

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01