Don't laugh.
I'm in a corporate environment with a locked down desktop. Installing third party apps is not an option.
Notepad is mostly okay, the biggest pain though is that it doesn't detect if a file is already open. I wind up with edits to files in two places.
So, I thought I would write a little vbs to check to see if the file might be open and instead of opening it twice, just raise the suspect window.
Dim Arg, var1
Set Arg = WScript.Arguments
'Parameter1, begin with index0
var1 = Arg(0)
set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
If Not oShell.AppActivate( fso.GetFileName(var1) + " - Notepad") Then
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Exec("notepad.exe " + var1 )
Set objShell = Nothing
End If
it works great. But...
I can't set a vbs to the target of an "Open With..." menu. It looks like I can do a .bat, .cmd, .exe, .pif. Manually selecting ".vbs" doesn't work. It will say that the .txt file "is not a valid win32 application"
How can I get a file's default action to open with a vbs script?