Subscribe Bookmark RSS Feed

Pressing the <Esc> key from within JSL

Is there a way within a JMP script to simulate pressing the key?

The reason I want to do it is that if I'm using the ArcBall feature to inspect a 3D scene that I've created, and I then try to switch to a different 3D scene while the first scene is still rotating, the second scene sometimes doesn't load (both in JMP 7 and JMP 8), especially if the first scene contains a lot of information. If however I stop the first scene from rotating first, then I don't have any problems. What I want to do therefore is ensure that at the time I load the second scene the first one isn't moving - and I can do that by pressing the key before swapping the scenes over. Since the scene switching is being done in JSL however, I don't want to have to do that manually.

I've tried incorporating "wait(0)" into the script but to no avail - and simulating is the only other way I can think of solving the problem. Obviously however if anyone has any better ideas, I'm all ears.
4 REPLIES
mattf

Community Trekker

Joined:

Jun 23, 2011

Here's one example to invoke an key programmatically.

The LoadDll function makes it easy -

(caution: some unusual things can happen while developing with keys - shift gets stuck down, etc..)

Excellent - I seem to have got it doing what I want now by extracting from the above script just the functions that I need to do the job. Many thanks!

Just to illustrate what I'm doing here for the record, if the following script is run in JMP 8 (it doesn't work in JMP 7), it writes a line of text within a 3D graphics window which can be rotated by dragging the cursor across it. If the key is held down while that's being done, the scene continues to rotate on its own - and it's that rotation that I want to be able to stop from a script (as opposed to the obvious method of just clicking once on the scene). The button I've added underneath is there to test that function.

mattf

Community Trekker

Joined:

Jun 23, 2011

Fun with JSL!

This example will spin the text, though pretty fast.

The starting cursor position is current hard-coded. I'm yet having a little trouble adujsting the mouse speed to get it to spin slower.

Best regards,
-Matt
This is extremely helpful: I'm still getting my head around the mechanics of it, but in the meantime I've discovered that inserting a wait(0.1) function between the MOVE and the LEFTUP actions as shown below slows down the rotation to the sort of speed I'm looking for. I've also modified the mouseclick function slightly so that it always flicks the mouse horizontally to the left from the centre of the Panel Box, wherever that is at the time:


The above doesn't always seem to work: sometimes it requires two or more attempts, which I think might possibly be caused by the need to hold down the button for at least as long as the interval specified. If it doesn't work at all then a click on the "Stop Rotation" button first seems to solve the problem. But these are teething problems: essentially it's there. Many thanks!

Best regards,
David