在当前鼠标位置旁边出现一个新窗口是否可以通过JSL获取鼠标的位置,然后在其右侧打开一个新窗口?看起来很直接,但是通过脚本帮助我无法弄明白。感谢您的指点!
史蒂夫
脚本回复:在当前鼠标位置旁边出现一个新窗口我可以让它通过 Windows Powershell ICE 工作,但不能通过 Windows Powershell 工作,不知道那是什么意思,只是把它扔到那里以防其他人这样做!
回复:在当前鼠标位置旁边出现一个新窗口我对 powershell 也不是很熟悉,我只在必要时才使用它。 您可以尝试运行该命令
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"
直接在 powershell 中查看是否出现相同的错误。 这是我通过命令行运行 powershell 的时候:

如果我通过搜索 powershell 的 Windows 运行命令,它似乎会返回类似的错误:

但是如果我在出错后再次运行它,它似乎会返回没有坐标的字符串或应该返回的坐标。
回复:在当前鼠标位置旁边出现一个新窗口JMP Pro 16.0,Windows 10 企业版 10.0.19044
回复:在当前鼠标位置旁边出现一个新窗口您的 JMP 是什么版本?
你运行的是 Windows 10 吗?
回复:在当前鼠标位置旁边出现一个新窗口感谢您提供建议的代码。我不熟悉 powershell,所以我只是抓住了你的代码并运行它并在日志中得到了这个:
“添加类型:无法添加类型。 此语言模式不支持新类型的定义。
在行:1 字符:1
+ 添加类型 -AssemblyName System.Windows.Forms
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Add-Type], PSNotSupportedException
+ FullyQualifiedErrorId : CannotDefineNewType,Microsoft.PowerShell.Commands.AddTypeCommand
找不到类型 [System.Windows.Forms.Cursor]。
在行:2 字符:6
+ $X = [System.Windows.Forms.Cursor]::Position.X
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo:InvalidOperation:(System.Windows.Forms.Cursor:TypeName)[],RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
找不到类型 [System.Windows.Forms.Cursor]。
在行:3 字符:6
+ $Y = [System.Windows.Forms.Cursor]::Position.Y
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo:InvalidOperation:(System.Windows.Forms.Cursor:TypeName)[],RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
十: | Y:“
我没有看到任何可用于鼠标位置的返回值。我是不是遗漏了什么或者我需要做些什么来设置 powershell?我正在使用两台显示器并在我的主显示器上运行脚本。
史蒂夫
回复:在当前鼠标位置旁边出现一个新窗口如果您使用的是 Windows,则可以使用 powershell。 这是一个示例(返回显示数量而不仅仅是坐标可能是个好主意):
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")
));
我通常通过在当前 window() 之上打开新窗口来管理这些,然后根据它计算位置。
回复:在当前鼠标位置旁边出现一个新窗口我认为可以从屏幕上的任何位置获取鼠标位置的唯一方法是通过 JMP 扩展到 R 或 Python。一旦返回鼠标位置,JSL 就可以创建 New Window(),然后将 Window() 移动到所需位置。