在當前鼠標位置旁邊出現一個新窗口是否可以通過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() 之上打開新窗口來管理這些,然後根據它計算位置。
回复:在當前鼠標位置旁邊出現一個新窗口我認為可以從屏幕上的任何位置獲取鼠標位置的唯一方法是通過 R 或 Python 中的 JMP 擴展。一旦返回鼠標位置,JSL 就可以創建 New Window(),然後將 Window() 移動到所需位置。