How to Get ScriptFullName, Path, etc.

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

MarquisEXB
Posts: 42
Joined: Mon Oct 05, 2009 12:04 pm

How to Get ScriptFullName, Path, etc.

Post by MarquisEXB » Tue Jan 12, 2010 2:32 pm

Is there a way to get ScriptFullName, FullName, and Path from a vbs? I'd like to get this dynamically, and usually the method is WScript.FullName, etc.

Thanks!
Image


MarquisEXB
Posts: 42
Joined: Mon Oct 05, 2009 12:04 pm

Re: How to Get ScriptFullName, Path, etc.

Post by MarquisEXB » Tue Jan 12, 2010 3:03 pm

Thanks, but what about ScriptFullName and FullName?
Image

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: How to Get ScriptFullName, Path, etc.

Post by Teknojnky » Tue Jan 12, 2010 3:39 pm

there is no such thing, at least anything officially designated as such by MM as it doesn't utilize them.

I suppose you could try reading the scripts.ini file, but this only lists scripts which are not automatically loaded at startup.

for what purpose are you trying to do?

edit:
there is also extentions.ini @ C:\Documents and Settings\All Users\Application Data\MediaMonkey but this is only used by MMIP installers, it would not include any scripts which are manually created or have their own installers.

MarquisEXB
Posts: 42
Joined: Mon Oct 05, 2009 12:04 pm

Re: How to Get ScriptFullName, Path, etc.

Post by MarquisEXB » Tue Jan 12, 2010 3:54 pm

Well I have a few versions of the same script that will load a playlist. Right now I have to hard code the playlist into the file, but if I can get the script name, then I can use it to parse the playlist name. This way I can just copy/rename the vbs to match those of the playlists.

Also I'd like to use this for simple logging. I can create a function that logs based on the file name of the vbs, without hardcoding the filename (IE use the same function over & over).

I guess the question is more academic than anything, since I can get around all of these issues.
Image

Peke
Posts: 12501
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: How to Get ScriptFullName, Path, etc.

Post by Peke » Wed Jan 13, 2010 5:14 pm

I'm not sure why you need to read names of scripts from other developers?

Not sure what you want to do, to use same script over and over on different playlists without hardcoding them into script?
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

MarquisEXB
Posts: 42
Joined: Mon Oct 05, 2009 12:04 pm

Re: How to Get ScriptFullName, Path, etc.

Post by MarquisEXB » Thu Jan 14, 2010 6:42 am

I don't need to read the script name of other developers. I'm trying to find a way to get my scripts to self realize their own names programatically. Frequently in vbs I use the script's name as the log file name, ini name, etc. In other words.

LogFileName = Replace(Wscript.ScriptFullName,".vbs", ".log")
IniFileName = Replace(Wscript.ScriptFullName,".vbs", ".ini")

Is there a way to do this in MM/vbs?
Image

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: How to Get ScriptFullName, Path, etc.

Post by Teknojnky » Thu Jan 14, 2010 9:54 am

sure just define them as constants at the start of the script or use the scriptfilename in the log.

Code: Select all

Option Explicit

' MediaMonkey Script
  Dim ScriptName : ScriptName = "MyScript"
  Dim Version : Version = "2010.01.14.0900"

or just do like this

Code: Select all

Sub logme(msg)
	'by psyXonova'
	If SDB.IniFile.BoolValue(Prefs,"Logging") Then
		Dim fso, logf
  On Error Resume Next
		Set fso = CreateObject("Scripting.FileSystemObject")
		Set logf = fso.OpenTextFile(Script.ScriptPath&".log",ForAppending,True)
		logf.WriteLine Now() & ": " & msg
		Set fso = Nothing
		Set logf = Nothing
	End If
End Sub

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: How to Get ScriptFullName, Path, etc.

Post by trixmoto » Thu Jan 14, 2010 1:47 pm

Maybe I'm misunderstanding you, but "Script.ScriptPath" seems to be exactly what you are asking for. If not, can you explain why not, maybe with some examples?
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

MarquisEXB
Posts: 42
Joined: Mon Oct 05, 2009 12:04 pm

Re: How to Get ScriptFullName, Path, etc.

Post by MarquisEXB » Thu Jan 14, 2010 4:53 pm

Ahhh yes just tried that - it is EXACTLY what I need. I thought that would just return the folder, not the entire path, so my mistake.

Thanks!
Image

Post Reply