Scripts discussion (2)
- Author
- Message
-
Offline
- Posts: 670
- Joined: Thu Jun 03, 2010 8:47 am
- Location: Сочи, Хоста
- Contact:
Создай файл SendKeys.vbs
Code: Select all
' Посылает одно или несколько нажатий клавиш
' в параметрах строка выполнения нажатий
CreateObject("WScript.Shell").SendKeys WScript.Arguments(0)-"Перейти на страницу вверх Page UP" Call("Scripts::Main", 1, "SendKeys.vbs", `"{PGUP}"`)
-"Ctrl +R" Call("Scripts::Main", 1, "SendKeys.vbs", `"^R"`)
-
Offline
- Posts: 874
- Joined: Sat Jan 16, 2010 2:03 pm
Thank you! Very helpful and simple!
2.
Наверное, чтобы не провоцировать такой реакции, следовало сразу объяснить свою мотивацию. Целью было написать скрипт, преобразующий макросы в скрипты (получить этакие легко редактируемые "псевдо-макросы"). Самым очевидным решением ("в лоб") представлялось перевести байт-последовательности в соответствующие им вызовы SendKeys.FeyFre wrote:opk44, не страдать фигней, и вызвать диалог коммандой AkelPAd.Command()
3. Andrey_A_A
Спасибо за предложение. Возьму на заметку.
4. На текущий момент есть некий "прототип" скрипта по преобразованию макросов в заготовки скриптов. Он очень сырой и многого "не умеет" (например не отлавливает переключение раскладки), но благодаря подсказке KDJ делает теперь "хоть что-то".
Например: [more="результат разбора макроса объединения строк от Surveyor = "Join selected lines.macro" (см. "Plugins-Eng.chm")"]
Code: Select all
C:\Program Files\Total Commander\Plugins\exe\AkelFiles\Plugs\Macros\Join selected lines.macro
Size: 432 bytes (54 keys)
----------------------------------------
VBScript template
----------------------------------------
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "^r"
WshShell.SendKeys ""
WshShell.SendKeys "n"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "-"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "-"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{+}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{UP}"
WshShell.SendKeys "{UP}"
WshShell.SendKeys "{UP}"
WshShell.SendKeys "{UP}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ESC}"
WshShell.SendKeys "{HOME}"
----------------------------------------
JScript template
----------------------------------------
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.SendKeys ("^r");
WshShell.SendKeys ("");
WshShell.SendKeys ("n");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys (" ");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("-");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("-");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("{+}");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("{UP}");
WshShell.SendKeys ("{UP}");
WshShell.SendKeys ("{UP}");
WshShell.SendKeys ("{UP}");
WshShell.SendKeys ("{DOWN}");
WshShell.SendKeys ("{DOWN}");
WshShell.SendKeys ("{DOWN}");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("{TAB}");
WshShell.SendKeys ("{ENTER}");
WshShell.SendKeys ("{ENTER}");
WshShell.SendKeys ("{ESC}");
WshShell.SendKeys ("{HOME}");
----------------------------------------примеч.: для получения работоспособного кода в JS из шаблона нужна еще дополнительная коррекция слешей (замена "" на "\")
5. Будь это еще кому-то интересно... Пока скрипт не достаточно оттестирован для выкладывания в соседней теме.