Button box prevents relative filepath from workingHi 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???
Re: Button box prevents relative filepath from workingThis does indeed work. Any idea though why the relative filepathing wasn't working the way it usually does?
Re: Button box prevents relative filepath from workingLooks 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);
);
);
);Re: Button box prevents relative filepath from workingAnybody??