Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Craige_Hales
Staff (Retired)
JMP's Recent File List (Windows)

This example uses Run Program to read the windows registry to get the files in JMP's recent file list.

temp=runprogram(executable("reg"),options({"query","\["HKCU\Software\SAS Institute Inc.\JMP\Recent\Files"]\"}),readfunction("text"));
names = {};
// typical line: "    File7    REG_SZ    C:\Users\v1\Desktop\Nanami01.jrn"
patmatch(temp,patrepeat(patregex("\s+File\d+\s+REG_SZ\s+")+patbreak("\!n\!r")>>path+pattest(insertinto(names,path);1)));
show(names,nitems(names))

names = {"F:\FileSnapper\Additional.jsl", "F:\FileSnapper\makeAddin.jsl", "F:\rectangula\virusmap3.jsl", "F:\rectangula\virusmap2.jsl", "F:\turtle\drawing.jmpprj", "F:\AVI\video.jmpprj", "C:\Users\v1\Desktop\Nanami01.jrn", "F:\chess\chessPlay.jsl", ...

 

The patmatch function skips over leading, non-matching text, then adds files to names as long as the pattern repeats. If the registry contained some other values (I don't know why it would) you might have to make the pattern more sophisticated to skip unknown keys and continue.

 

Running the reg query command in a command window looks like this

Capture1.PNG

readfunction("text") returns that same text to the temp variable.

 

Article Labels

    There are no labels assigned to this post.

2 Comments
Level VI

Well that is very cool and compact.  I could see this being useful in building a custom dialog for file selection.  

Staff (Retired)

Thanks! It is simpler than another approach I tried that was more fragile.

I also looked atWindows 10 Recent Files and Folders: Pointing to the "Quick Access" file and folder list in a JSL sc...  @phil_kay which got me close to similar information, but for .LNK files that, somehow, point to the actual files. In my case I need the path to the target file, and I don't know how to get the path from a .LNK using JSL.