Skip to content

Instantly share code, notes, and snippets.

@miku-orb
Last active December 4, 2024 20:42
Show Gist options
  • Select an option

  • Save miku-orb/4512c0f72d08215ba092dbc17675eaf0 to your computer and use it in GitHub Desktop.

Select an option

Save miku-orb/4512c0f72d08215ba092dbc17675eaf0 to your computer and use it in GitHub Desktop.
Ta metoda to była tragedia!
#include <WindowsConstants.au3>
#include "SendMessage.au3"
#include <GuiMenu.au3>
$File = "kontrolne_do_dopisania.txt"
$h = FileOpen($File, 0)
while 1
$NextLine = FileReadLine($h)
if @error Then
FileClose($h)
ExitLoop
Else
ConsoleWrite("Reading next line:" & $NextLine & @CRLF)
WinActivate("[CLASS:TOPACSearchForm]")
;Send($NextLine, 1)
;Send("{ENTER}")
;ControlSend("[CLASS:TOPACSearchForm]", "", "[CLASS:Edit; X:3; Y:3; W:222; H:15]", $NextLine, 1)
;ControlClick("[CLASS:TOPACSearchForm]", "", "[CLASS:Edit]")
ControlFocus("[CLASS:TOPACSearchForm]", "", "[CLASS:Edit]")
Sleep(50)
ControlSend("[CLASS:TOPACSearchForm]", "", "[CLASS:Edit]", "{HOME}+{END}", 0)
;Sleep(5)
ControlSend("[CLASS:TOPACSearchForm]", "", "[CLASS:Edit]", "{BACKSPACE}", 0)
;Sleep(5)
ControlSend("[CLASS:TOPACSearchForm]", "", "[CLASS:Edit]", $NextLine, 1)
ControlClick("[CLASS:TOPACSearchForm]", "", "[CLASS:TButton; TEXT:&Search]")
;MsgBox(0, "eee", $NextLine)
WinWaitActive("[CLASS:TOPACRecordViewForm]")
Sleep(20)
ControlClick("[CLASS:TOPACRecordViewForm]", "", "[CLASS:TPanel]", "right")
WinWait("[CLASS:#32768]")
;ControlClick("[CLASS:TOPACRecordViewForm]", "A&dd Symbol...", "[CLASS:#32768]", "left")
;ControlClick("[CLASS:#32768]", "A&dd Symbol...", "[CLASS:#32768]", "left")
;WinMenuSelectItem("[CLASS:#32768]", "", "A&dd Symbol...")
;WinMenuSelectItem("[CLASS:TOPACRecordViewForm]", "", "A&dd Symbol...")
;;WinMenuSelectItem("[CLASS:TVirtuaMainForm]", "", "View Record", "A&dd Symbol...")
$hWnd = WinGetHandle("[CLASS:#32768]")
$hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0)
If _GUICtrlMenu_IsMenu($hMenu) Then
$iCount = _GUICtrlMenu_GetItemCount($hMenu)
;MsgBox(0, $iCount, "ok1")
For $iIndex = 0 To $iCount - 1
Local $sText = _GUICtrlMenu_GetItemText($hMenu, $iIndex)
;MsgBox(0, $sText, "ok2")
If $sText = "A&dd Symbol..." Then
;MsgBox(0, $NextLine, "ok3")
$aPos = _GUICtrlMenu_GetItemRect($hWnd, $hMenu, $iIndex)
;$iOldOpt = Opt("MouseCoordMode", 0)
MouseClick("primary", $aPos[0] + 5, $aPos[1] + 5, 1, 0) ; Adjust the speed to suit
;MsgBox(0, $aPos[0], $aPos[1])
;Opt("MouseCoordMode", $iOldOpt)
EndIf
Next
EndIf
WinWait("[CLASS:TMessageForm]")
;$MsgText = WinGetText("[CLASS:TMessageForm]")
$MsgText = WinGetTitle("[CLASS:TMessageForm]")
;If (Not StringInStr($MsgText, "The library symbol has been successfully modified.")) And (Not StringInStr($MsgText, "Supplied symbol already in bib record (when adding)")) Then
If $MsgText <> "Information" Then
;;MsgBox(0, $NextLine, "some error: " & $MsgText)
Sleep(500)
EndIf
ControlClick("[CLASS:TMessageForm]", "", "[CLASS:TButton; TEXT:OK]", "left")
EndIf
WEnd
MsgBox(0, '', "done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment