Is there any way I could open the file without specifying the prefix path? In one of my scripts when I type Open(filename.jmp) it works, but doesn't when I try and open it from a window in the follwing example, any idea as to why? I keep getting the error with a \ in front of the file name for some reason? If I specify the full path for the file it works, but I need it to work when only the file name is provided.
OKScript = Expr( win1 << CloseWindow; lf = ListF << GetItems; If( N Items( lf ) < 1, Warning( "ERROR: You need to select at least one file" ); Throw(); ); For( i = 1, i <= N Items( lf ), i++, print(lf[i]); dt=Open(lf[i]); ); ); );
The Get Path Variable() function returns the current value (a path) stored in a JMP path variable. The argument is not a file name but a path variable. See Help > Books > Scripting Guide and look up path variables.
I read up and realised I was using the wrong function so tried convert file path instead. This works sometimes but not other times. For example in my program I have a file called "Test 1 PFD.jmp" and when I print the convert file path of "Test 1 PFD.jmp" it returns "/Test 1 PFD.jmp" in the log, instead of the full file path.
Also tried the following which doesn't seem to be working:
dt = Open("123456700000.csv"); path = Arg(dt << get property("Source"), 1); print("path: " || Arg(dt << get property("Source"), 1));
Again, it prints the name of the file with a \ instead of the file path.