169 похожих чатов

#SingleInstance force ; Function to retrieve COM port information for a

specific port
GetComPortInfo(port) {
; Run PowerShell command to get device name associated with the port
RunWait, %ComSpec% /c powershell.exe -Command "(Get-WmiObject Win32_PnPEntity | Where-Object { $_.Name -match 'COM' + port }).Name", , UseErrorLevel, Output
if !ErrorLevel {
return "Device connected to COM" port ": " Output
} else {
return "No device found on COM" port
}
}

; Function to display text on OSD
ShowOnScreenDisplay(text) {
; Here you should call the appropriate function or method
; to display text on the OSD.
; Replace the following line with the actual function call
MsgBox, % text
}

; Function to retrieve list of connected COM ports
GetConnectedComPorts() {
ports := []
; Run 'mode' command to get a list of active COM ports
RunWait, %ComSpec% /c mode, , UseErrorLevel, Output
if !ErrorLevel {
Loop, Parse, Output, `n
{
; Extract port name from each line of output
if (RegExMatch(A_LoopField, "COM\d+", port))
ports.push(port)
}
}
return ports
}

; Example usage
connectedPorts := GetConnectedComPorts()
if (connectedPorts.length() > 0) {
for each, port in connectedPorts {
comPortInfo := GetComPortInfo(port)
ShowOnScreenDisplay(comPortInfo)
}
} else {
MsgBox, No COM ports found.
}


can anyone help me to improve the script to show tooltip only when com port device connected with its proper full name?

2 ответов

42 просмотра

Стикер

MD-SRK Автор вопроса

maybe you didn't read the full sentences

Похожие вопросы

Обсуждают сегодня

А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
Подскажите, где смотреть результат выполнения программы? Код: ;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, станда...
Егор Анелькин
5
Где в Астане можно купить мясо для шашлыков?
Dancing Іңұқәһүғө
21
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
Добрый день подскажите пожалуйста может кто то сталкивался с ошибками Sentry 22.10.0 развернутым из helm чарт в Kubernetes? Изначально 3 дня назад очень стало много событий ух...
Tire4 Finist Devops
1
всем привет почти закончил курс После него можно писать свою операционку? Какие библиотеки надо использовать и куда дальше копать для изучения
Linus
22
почому оно не работает?
Vi Chapmann ٩( 💢•̀ з•́)و Chapmann
19
Так а кто может спарсить всех участников чата? Идишники
Magic
18
Карта сайта