Greetings Dopus Fraternity
Is this a feasible spec for ascript?
With a file highlighted
Invoke the script
Script copies the name of the file (no extension)
Creates a text file with same name in the same folder
Opens the text file
Script ends
This post suggests that I might get quite far using internal command..but maybe not far enough?
any thoughts or suggestions greatly appreciated as always.
function OnClick(clickData)
{
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection
var src = clickData.func.sourcetab;
if (src.selected_files.count==0) return; // No files are selected
var txt_filespec = src.selected_files(0).path + "\\" + src.selected_files(0).name_stem + ".txt";
if (DOpus.FSUtil.Exists(txt_filespec)==false){ // Don't interfere with an existing text file
var fso = new ActiveXObject("Scripting.FileSystemObject");
var ForWriting = 2;
var txt_fil = fso.OpenTextFile(txt_filespec,ForWriting,true);
txt_fil.close();
}
cmd.RunCommand("Notepad " + txt_filespec);
}
@aussieboykie thank you so much it works a treat.
I had some trouble (Like it has to JScript not VB - doh!)
Work perfectly and I have a basis to edit, extend and learn as I go.
Saved me many many hours.
Thank you sir.
Brisbane Boy