Option Explicit ' Edit Last NWC2 User Tool Run' Standalone script, not a User Tool' by Rick G. tested on Win98, NWC2 Beta 2.19Const exts = ".php|.vbs|.js|.py|.cmd|.bat"Const NWC2RK = "HKCU\Software\NoteWorthy Software\NoteWorthy Composer 2\"Dim wso: Set wso = CreateObject("WScript.Shell")Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")Dim sho: Set sho = CreateObject("Shell.Application")Dim ext, delimiter, lut, slut = wso.RegRead(NWC2RK & "Options\LastToolRun")s = fso.BuildPath(NWC2Folder("Config"), "nwc2UserTools.ini") ' filenames = fso.OpenTextFile(s).ReadAll ' file contentss = Filter(Split(s, vbCr), vbLf & lut & "=")(0) ' pertinent line from files = Split(s, "=")(1) ' &Command:For Each ext In Split(exts & "|", "|") If InStr(1, s, ext, 1) Then Exit ForNextIf ext = "" Then WScript.Quit ' no matchIf Asc(s) = 39 Then s = Mid(s, 2, Len(s) - 2) ' strip single quotesdelimiter = Mid(s & " ", InStr(1, s, ext, 1) + Len(ext), 1) ' space|quotes = Filter(Split(s, delimiter), ext, vbTrue, 1)(0) ' relative pathwso.CurrentDirectory = NWC2Folder("root")s = fso.GetAbsolutePathName(s)sho.Namespace(Left(s, 3)).ParseName(Mid(s, 4)).InvokeVerb("&Edit")Function NWC2Folder(sKey) Select Case sKey Case "Songs": NWC2Folder = wso.SpecialFolders("MyDocuments") Case "InstrumentTrees": NWC2Folder = "itrees" Case "AutoSave", "Config", "Templates": NWC2Folder = sKey Case "PageCopy", "root" Case Else: Err.Raise 17, "NWC2Folder", sKey ' bad sKey End Select On Error Resume Next NWC2Folder = wso.RegRead(NWC2RK & sKey) If Err = 0 Or sKey = "Songs" Then Exit Function NWC2Folder = fso.BuildPath(fso.GetFile( _ wso.RegRead("HKCR\nwcomposer\shell\nwc2\command\") _ ).ParentFolder, NWC2Folder)End Function
The fact that this opens the last tool used is a useful thing I reckon - that's the one most likely to need editing if one is working on developing a user tool.
Still, it would be nice to be able to execute it from within NWC2 itself...
I started off on TI58 programmable calculators.
When I was working on scripts a lot, I'd just have the scripts folder open.Often I'd have the script loaded in notepad or whatever, and just keep saving it and rerunning.<snip>
I presume by TSE, you mean "The Semware Editor". I've used it since it was QEdit (TSR under MS-DOS) and have upgraded ever since. Best text editor I ever used and it's macro and repeat ability makes it a breeze to edit anything that has some sort of pattern to it.
Page created in 0.098 seconds with 25 queries.