Guest User

Untitled

a guest
Dec 23rd, 2011
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var args = WScript.Arguments;
  2.  
  3. if ( args.Unnamed.length != 1 ) {
  4.     WScript.Echo([
  5.         'Usage: ',
  6.         WScript.ScriptName + ' [/A] path [/S]',
  7.         '',
  8.         '/A - Show Artist Info (by default - Album Info)',
  9.         '/S - Suppress a message if an Info file does not exist',
  10.     ].join('\n'));
  11.     WScript.Quit();
  12. }
  13.  
  14. var fso = new ActiveXObject('Scripting.FileSystemObject');
  15.  
  16. var info_file = args.Unnamed.item(0);
  17.  
  18. if ( ! fso.FileExists(info_file) ) {
  19.     WScript.Echo('Could not to find the info file: ' + info_file);
  20.     WScript.Quit();
  21. }
  22.  
  23. info_file = fso.GetFile(info_file).ParentFolder;
  24.  
  25. if ( args.Named.Exists('A') ) {
  26.     info_file = info_file.ParentFolder;
  27. }
  28.  
  29. info_file += '\\info.txt';
  30.  
  31. if ( ! fso.FileExists(info_file) && ! args.Named.Exists('S') ) {
  32.     WScript.Echo('File not found: ' + info_file);
  33.     WScript.Quit();
  34. }
  35.  
  36. var shell = WScript.CreateObject('WScript.Shell');
  37.  
  38. shell.Run('notepad.exe "' + info_file + '"', 1, false);
Advertisement
Add Comment
Please, Sign In to add comment