在当前鼠标位置旁边出现一个新窗口是否可以通过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 时的情况:

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

但如果我在错误发生后再次运行它,它似乎会返回没有坐标的字符串或应有的坐标。
回复:在当前鼠标位置旁边出现一个新窗口JMP Pro 16.0、Windows 10 企业版 10.0.19044
回复:在当前鼠标位置旁边出现一个新窗口您的 JMP 版本是什么?
您运行的是 Windows 10 吗?
回复:在当前鼠标位置旁边出现一个新窗口感谢您建议的代码。我不熟悉 powershell 所以我只是抓住你的代码并运行它并在日志中得到这个:
“添加类型:无法添加类型。 此语言模式不支持新类型的定义。
行:1 字符:1
+ 添加类型 -AssemblyName System.Windows.Forms
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [添加类型],PSNotSupportedException
+FullyQualifiedErrorId:无法定义NewType,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
+ FullQualifiedErrorId:类型未找到
无法找到类型 [System.Windows.Forms.Cursor]。
行:3 字符:6
+ $Y = [System.Windows.Forms.Cursor]::Position.Y
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Windows.Forms.Cursor:TypeName) [], RuntimeException
+ FullQualifiedErrorId:类型未找到
X:|是:”
我没有看到任何可以用于鼠标位置的返回内容。我是否遗漏了什么或者我需要做些什么来设置 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() 之上打开新窗口来管理这些窗口,然后根据该窗口计算位置。
回复:在当前鼠标位置旁边出现一个新窗口我认为可以从屏幕上的任何位置获取鼠标位置的唯一方法是通过 R 或 Python 中的 JMP 扩展。一旦返回鼠标位置,JSL 就可以创建 New Window(),然后 Move Window() 到所需位置。