Subscribe Bookmark RSS Feed

Is there a way to add to the undo stack with JSL?

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Hi, I have several very simple (1 to 4 line) scripts for common tasks. Most are benign and can be undone by clicking on the icon again (Ex: Toggle high / exclude for a row).  I just added one to delete selected rows.  Ideally this would go to the undo stack. Is this possible?

8861_pastedImage_0.png

Ex: Delete rows, select matching, select non-matching, and a more advanced columns selection tool (pretty much useless since I learned about the column filter selector feature).  The first is the only one I'd need to undo.

Script is:

current data table() << delete rows;

Thanks

Mike

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Maybe it's possible to run the Main Menu() function from a custom toolbar command (Main Menu("Delete Rows") does of course not work if run from the jsl-editor... but from the toolbar it might).

Try toggling between these two in a clever way:

Main Menu("Delete Rows")

Main Menu("Undo")


5 REPLIES
mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Figured I would bump this once before I give up on the idea. ...  to restate the question: Is it possible to add any hooks into a script so that the 'undo' feature will undo what the script has done?  For this case, I would want to un-delete whatever rows were just deleted.

Thanks,

Mike

Solution

Maybe it's possible to run the Main Menu() function from a custom toolbar command (Main Menu("Delete Rows") does of course not work if run from the jsl-editor... but from the toolbar it might).

Try toggling between these two in a clever way:

Main Menu("Delete Rows")

Main Menu("Undo")


mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

Actually, I didn't really need a script to trigger the undo, just make it so that a ctrl-z or manual undo would work.  Using the Main Menu("Delete Rows") command enables the undo to work, so it works perfectly now. Good to know about this Main Menu() feature.

Thanks!

-Mike

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011


Main Menu("Delete Rows") does of course not work if run from the jsl-editor...


I thought it worth mentioning in case others are interested: For me, Main Menu("Delete Rows") does work from the JSL editor in JMP 11.2 standard / win 8.

On the other hand (and maybe this is what you meant), Main Menu("Undo"); from the JSL editor definitely doesn't undo the last table operation.  I ran it from the JSL editor and thought I forgot to add the semicolon. Then I realized... undo...

ms

Super User

Joined:

Jun 23, 2011

Yes it was "Undo" (and "Delete") that leads to unpredictable results if run from the editor. And you're right, Main Menu("Delete Rows") works from the editor. I probably assumed it didn't as the Rows Menu disappears when the script window is in front.