[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
bat
  1. mshta vbscript:Execute("CreateObject(""WScript.Shell"").SendKeys ""^M"" : window.close")
复制代码
ahk
  1. Send,^M
  2. ExitApp
复制代码
你确定是大写的M?

TOP

回复 7# FU586097


    你想要怎么触发?

TOP

回复 10# FU586097


    我不了解海王星,你说鼠标必须必须在软件上所以点不了脚本运行,我问的是你想要以什么条件运行脚本,其他按键触发、定时触发什么的

TOP

本帖最后由 buyiyang 于 2023-3-17 10:18 编辑
师傅 对不起  我是需要打开海王星软件后 用快捷键调出多股同列的 鼠标必须在软件界面上  因此无法用ahk  但是 有其它方法达到吗  谢谢
FU586097 发表于 2023-3-16 17:34

建议使用鼠标宏

TOP

回复 14# FU586097


    你百度一下就知道鼠标宏是什么了

TOP

回复 16# FU586097


    代码中的M改成小写m

TOP

本帖最后由 buyiyang 于 2023-3-23 18:41 编辑

回复 20# FU586097


    ahk
  1. SetTitleMatchMode, 2
  2. WinTitle = 海王星 ; 前面设置窗口标题
  3. WinActivate, %WinTitle%
  4. WinWaitActive, %WinTitle%
  5. Send, ^m
  6. ExitApp
复制代码

TOP

回复 22# FU586097


    只要有可区分的关键词就行
1

评分人数

TOP

回复 24# FU586097


    看窗口title,看不到或者不会看,就到autohotkey安装文件夹里找到WindowSpy,用它看,勾选follow mouse,第一个方框第一个就是

TOP

本帖最后由 buyiyang 于 2023-3-21 16:30 编辑

这个问题我又琢磨了一下
ps1
  1. $title = '海王星'
  2. $process = Get-Process | Where-Object {$_.MainWindowTitle -like "*{0}*" -f $title}
  3. if ($process) {
  4.     $handle = $process.MainWindowHandle
  5.     Add-Type @'
  6.     using System;
  7.     using System.Runtime.InteropServices;
  8.     public static class User32 {
  9.         [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
  10.         [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
  11.         [DllImport("user32.dll")] public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
  12.     }
  13. '@
  14.     [void][User32]::SetForegroundWindow($handle)
  15.     [void][User32]::ShowWindow($handle, 9)
  16.     [User32]::keybd_event(17, 0, 0, 0)
  17.     [User32]::keybd_event(77, 0, 0, 0)
  18.     Start-Sleep -Milliseconds 50
  19.     [User32]::keybd_event(77, 0, 2, 0)
  20.     [User32]::keybd_event(17, 0, 2, 0)
  21. } else {
  22.     Write-Host 没有找到有关 $title 的窗口
  23.     Start-Sleep 2
  24. }
复制代码
vbs
  1. Set WshShell = CreateObject("WScript.Shell")
  2. WshShell.AppActivate("海王星")
  3. WScript.Sleep(500)
  4. WshShell.SendKeys("^m")
复制代码

TOP

返回列表