Probably to be expected, but '<<getPath' doesn't necessarily return the correct path to the file until the table has actually been saved. But you can get the path of the CSV file from the 'Source' script in the table (see below).
But I have the sense that you want to do this many times, in which case the code below shuld get you started.
If you are new to JMP, use 'Help > Scripting Index' to understand how each line works. If you really do want to do this for multiple files, you can delete the lines ending in '//'.
NamesDefaultToHere(1);
// Pick a directory
dir = pickDirectory("Pick a directory containing .CSV files:", "$DESKTOP");
// Get the .CSV files it contains
fList = filesInDirectory(dir);
for(f=NItems(fList), f>=1, f--,
ext = ".CSV";
if(!endsWith(uppercase(fList[f]), ext), removeFrom(fList, f));
);
// Loop over the .CSV files and save each one as a .JMP file to the same location
for (f=1, f<=NItems(fList), f++,
dt = Open(dir||"/"||fList[f], Invisible);
Print("Path to (unsaved!) JMP table is: "||(dt << getPath)); //
sourceScript = dt << getScript("Source"); //
Print("Path to source file is: "||Arg(sourceScript, 1)); //
Close(dt, Save(dir||"/"||Word(1, fList[f], ".")||".jmp"));
Print("Saved "||dir||"/"||Word(1, fList[f], ".")||".jmp ... ");
);