Disclaimer: This isn't so much a question as an answer to a question. I thought about sharing this in a blog entry, but it may not be the type of hack to be proud of. So:
In the back of my mind, I've been looking for a way to embed JMP Workflows in a journal so that, when I click a button in a demo, a new Workflow pops up, already populated with steps. I'm in the habit of sharing journals after demos, so I wanted the workflow to be embedded in the journal instead of having to deal with telling people to "unzip all the contents into a single folder...".
Here's a script that does that. In short: the script asks for a filename, then creates JSL to recreate that file on the user's desktop and open it. The script is then copied to the clipboard, so I can put that into a button in a journal. I've tested it with a few .jmpflow & .jmpdoe files and it works for all I've tested it with.
Here's the script. If there's a better approach, or a better place to share this, let me know.
//Create a pasteable script to recreate a jmpflow (or jmpdoe) file
//useful for embedding in demo journals
//v0.1
//Jed Campbell
//10/11/23
Names Default To Here (1);
nw = new window ("File Embed Tool",
Button Box( "Embed File into a Script",
//get file name/path
path = Pick File();
fname = Word( -1, path, "/" );
//load into memory
t = Load Text File( path );
//make quotes into escaped quotes
u = Substitute( t, "\!"", "\\!!\!"" );
//chunk together JSL into a string on clipboard
codea = "Save Text File (\!"$DESKTOP/"||fname||"\!", \!"" || u || "\!");";
codeb = "\!nOpen (\!"$DESKTOP/" || fname || "\!");";
script = codea || codeb;
Set Clipboard( script );
//msg user
Caption( "Script copied to clipboard." );
Wait( 1.5 );
Caption( remove );
)
);