Is it possible through JSL to get the location of the mouse and then have a new window open to the right of it? It seems straight forward enough but looking through the scripting help I couldn't figure it out. thanks for any pointers!
Steve
The only way that I believe that one can get the mouse position from anywhere on the screen, would be through either the JMP extension into R or Python. Once the mouse position is returned, then JSL can create the New Window(), and then Move Window() to the desired position.
If you are using windows you could use powershell. Here is one example (might be good idea to return also number of display and not just coordinates):
Names Default To Here(1); powershell_variables = Eval Insert("\[Add-Type -AssemblyName System.Windows.Forms $X = [System.Windows.Forms.Cursor]::Position.X $Y = [System.Windows.Forms.Cursor]::Position.Y Write-Output "X: $X | Y: $Y"]\", "¤"); //fix quotes and cleanup quote="\!""; escapedquote = "\!\\!""; Substitute Into(powershell_variables, quote, escapedquote); r = Trim Whitespace(Run Program( Executable( "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" ), Options({powershell_variables}), Read Function("text") ));
I have usually managed these by opening new windows on top of current window() and then calculated the location based on that.
thanks for the suggested code. I'm not familiar with powershell so I just grabbed your code and ran it and got this in the log:
"Add-Type : Cannot add type. Definition of new types is not supported in this language mode.At line:1 char:1+ Add-Type -AssemblyName System.Windows.Forms+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : PermissionDenied: (:) [Add-Type], PSNotSupportedException+ FullyQualifiedErrorId : CannotDefineNewType,Microsoft.PowerShell.Commands.AddTypeCommandUnable to find type [System.Windows.Forms.Cursor].At line:2 char:6+ $X = [System.Windows.Forms.Cursor]::Position.X+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (System.Windows.Forms.Cursor:TypeName) [], RuntimeException+ FullyQualifiedErrorId : TypeNotFoundUnable to find type [System.Windows.Forms.Cursor].At line:3 char:6+ $Y = [System.Windows.Forms.Cursor]::Position.Y+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (System.Windows.Forms.Cursor:TypeName) [], RuntimeException+ FullyQualifiedErrorId : TypeNotFoundX: | Y:"
I didn't see anything returned that I could use for the position of the mouse. Am I missing something or do I need to do something to set up powershell? I'm using two monitors and running the script on my primary one.
What is your version of JMP?
Are you running Windows 10?
JMP Pro 16.0, Windows 10 Enterprise version 10.0.19044