Copy link to clipboard
Copied
myPanel.grp.groupOne.groupTwo.openProjectButton.onClick = function () {
var projFile = new File(prefLoad("Template Project", 2));//my prefload function is returning a valid file path
alert("trying to open the project at " + projFile);//this alert was showing the file path until I inserted the new File() into the variable
try {
app.open(projFile);
} catch (err) {
alert(err);// nothing comes up with this error
}
}
Copy link to clipboard
Copied
What is prefLoad returning? Presumably a file path? But then if you were previously returning a file path string into projFile but then added 'new File' that turned it into a File object, your alert probably isn't going to like that (i.e. should be projFile.path in alert perhaps). Although if you're using a debugger I would expect it to flag that.
Copy link to clipboard
Copied
Yes, it's returning a file path stored as a string in preferences. Changing the alert to use the .path parameter seems to fix it. I'm not sure why im' not getting any debugging with my setup. I'm using Visual Studio Code with the Extendscript Debugger installed. When there is a minor error like you spotted, it just won't run and gives no feedback.
Copy link to clipboard
Copied
You're going into VScode's 'Run and Debug' section and clicking 'Attach to Extendscript Engine' then seeing the bar at the bottom turn orange? Just a simple $.writeln("hello world"); script should verify it's being sent back to the VScode Debug Console.
To be honest it's all a bit fiddly and confusing getting it set up and working. And if you're on an OS that still supports the old Extendscript Toolkit and that ever gets a chance to launch, you then have to quit and relaunch AE to get it to allow a VScode session.
Copy link to clipboard
Copied
Thanks for that tip. I'd been using the other option to launch it so never got the debugging. You solved two problems!