cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Due to global connectivity issues impacting AWS Services, users may experience unexpected errors while attempting to authorize JMP. Please try again later or contact support@jmp.com to be notified once all issues are resolved.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
DannyORegan94
Level II

Button box prevents relative filepath from working

Hi all,

 

I was messing around and discovered something strange. If I save the below script into the same folder as the 'Config File.jmp" file and then try to run it, the following error is produced when i press the button to open the config file: "Error with file: Path is invalid: \Config File.jmp."

F_Open  = function({columntoread},{defaultlocal},
	Open("Config File.jmp")
);

new window("test",
	buttonbox("go",
		script(
			F_Open("Directories");
		);
	);
);

Yet if I just run the line "Open("Config File.jmp")"  from within the script without moving any files around, the data table opens fine.

Also, if I change the relative filepath to the full filepath, ie "C:\....\Config.File.jmp", suddenly the button box works.

 

Any idea why this is happening???

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Button box prevents relative filepath from working

Looks like the function doesn't know the current directory.  Try this code, which passes the current directory into the function as an argument:

F_Open  = function({columntoread, current_path},{defaultlocal},
	Open(current_path || "Config File.jmp");
);
curpath = get default directory();
new window("test",
	buttonbox("go",
		script(
			F_Open("Directories", curpath);
		);
	);
);

View solution in original post

3 REPLIES 3
DannyORegan94
Level II

Re: Button box prevents relative filepath from working

Anybody??

pmroz
Super User

Re: Button box prevents relative filepath from working

Looks like the function doesn't know the current directory.  Try this code, which passes the current directory into the function as an argument:

F_Open  = function({columntoread, current_path},{defaultlocal},
	Open(current_path || "Config File.jmp");
);
curpath = get default directory();
new window("test",
	buttonbox("go",
		script(
			F_Open("Directories", curpath);
		);
	);
);
DannyORegan94
Level II

Re: Button box prevents relative filepath from working

This does indeed work. Any idea though why the relative filepathing wasn't working the way it usually does?

Recommended Articles