How to Get ScriptFullName, Path, etc.
Moderator: Gurus
-
- Posts: 42
- Joined: Mon Oct 05, 2009 12:04 pm
How to Get ScriptFullName, Path, etc.
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!
Thanks!
-
- Posts: 42
- Joined: Mon Oct 05, 2009 12:04 pm
Re: How to Get ScriptFullName, Path, etc.
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.
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.
New script:
Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page


Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page

-
- Posts: 42
- Joined: Mon Oct 05, 2009 12:04 pm
Re: How to Get ScriptFullName, Path, etc.
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.
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.
Re: How to Get ScriptFullName, Path, etc.
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?
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


How to add SCREENSHOTS to forum
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying


How to add SCREENSHOTS to forum
-
- Posts: 42
- Joined: Mon Oct 05, 2009 12:04 pm
Re: How to Get ScriptFullName, Path, etc.
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?
LogFileName = Replace(Wscript.ScriptFullName,".vbs", ".log")
IniFileName = Replace(Wscript.ScriptFullName,".vbs", ".ini")
Is there a way to do this in MM/vbs?
Re: How to Get ScriptFullName, Path, etc.
sure just define them as constants at the start of the script or use the scriptfilename in the log.
or just do like this
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
New script:
Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page


Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page

Re: How to Get ScriptFullName, Path, etc.
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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
-
- Posts: 42
- Joined: Mon Oct 05, 2009 12:04 pm
Re: How to Get ScriptFullName, Path, etc.
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!
Thanks!