What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to update the DP filename as personal Msg

How to update the DP filename as personal Msg
Author: Message:
Danny22
New Member
*


Posts: 11
Joined: Dec 2008
RE: RE: How to update the DP filename as personal Msg
quote:
Originally posted by Jesus

...which essentially does the same as
js code:
Messenger.MyPersonalMessage = fileName.Name.substring(0, fileName.Name.lastIndexOf("."))
back on windows, so it's tested this time ;)

Sorry but that is not completely correct.
A file does not have to have an extension (.xxx).
lastIndexOf() will return -1 if there is no period in the string.
This leaves us with substring(0, -1), which will return "".

If I should further explain why I wrote the code that way, I will do so...

The reason why I used a new function, is to seperate your custom code from the original code as much as possible. It is easier for you to make changes that way.
You can of course use fileName.Name instead, because it does not really matter which one you use in this case.
However, by using fileName.Path, you can use both the full path (NewFileName) and just the name (tempFileName) in your own code without making any changes if you somehow want to do something with both.
I like clean and reliable code.
To make it extra clean, you could even put your own code in new files if there is a lot of code.

Please correct me if I am mistaken about anything.

This post was edited on 01-19-2009 at 08:39 PM by Danny22.
01-19-2009 08:31 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How to update the DP filename as personal Msg - by tantiger on 01-18-2009 at 02:38 PM
RE: How to update the DP filename as personal Msg - by matty on 01-18-2009 at 02:59 PM
RE: How to update the DP filename as personal Msg - by tantiger on 01-18-2009 at 03:55 PM
RE: How to update the DP filename as personal Msg - by Danny22 on 01-18-2009 at 07:16 PM
RE: How to update the DP filename as personal Msg - by tantiger on 01-19-2009 at 02:49 AM
RE: How to update the DP filename as personal Msg - by Jesus on 01-19-2009 at 03:27 AM
RE: How to update the DP filename as personal Msg - by tantiger on 01-19-2009 at 08:15 AM
RE: How to update the DP filename as personal Msg - by Jesus on 01-19-2009 at 02:12 PM
RE: How to update the DP filename as personal Msg - by tantiger on 01-19-2009 at 03:04 PM
RE: How to update the DP filename as personal Msg - by Jesus on 01-19-2009 at 03:46 PM
RE: How to update the DP filename as personal Msg - by Danny22 on 01-19-2009 at 06:39 PM
RE: How to update the DP filename as personal Msg - by Jesus on 01-19-2009 at 07:04 PM
RE: RE: How to update the DP filename as personal Msg - by Danny22 on 01-19-2009 at 08:31 PM
RE: How to update the DP filename as personal Msg - by Jesus on 01-20-2009 at 02:06 AM
RE: How to update the DP filename as personal Msg - by Danny22 on 01-20-2009 at 10:31 AM
RE: How to update the DP filename as personal Msg - by tantiger on 01-20-2009 at 01:50 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On