#include #include #include ; Показываем форму $hGui=GUICreate("Печать из SCAD", 220, 200,110,700, -1, $WS_EX_TOPMOST) GUICtrlCreateLabel("Номер файла ( xx.jpg ):", 10, 10) $Text=GUICtrlCreateEdit ("11", 130, 7, 30, 20, $ES_AUTOVSCROLL + $ES_NOHIDESEL + $ES_WANTRETURN) GUICtrlCreateLabel("Текст комментариев:", 10, 30) $Text2=GUICtrlCreateEdit (" ", 10, 45, 200, 45, $ES_AUTOVSCROLL + $ES_NOHIDESEL + $ES_WANTRETURN) $button_print = GUICtrlCreateButton("Печать", 110, 100, 100, 25) $button_print_status = GUICtrlCreateProgress(110, 135, 100, 15) $button_2 = GUICtrlCreateButton("Шкала арм. x2", 10, 100, 90, 25) $button_3 = GUICtrlCreateButton("Шкала арм. x3", 10, 130, 90, 25) $button_4 = GUICtrlCreateButton("Шкала арм. x4", 10, 160, 90, 25) $button_about = GUICtrlCreateButton("О программе", 110, 160, 100, 25) $scale0 = "0" $scale1 = "2,62" $scale2 = "5,24" $scale3 = "9,32" GUISetState() ; Ждём нажатия кнопки While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button_print print() Case $msg = $button_2 Button2() Case $msg = $button_3 Button3() Case $msg = $button_4 Button4() Case $msg = $button_about About() EndSelect WEnd Func Button2() $aMPos = MouseGetPos() WinActivate('[REGEXPTITLE:Structure CAD]') ; Вызываем настройку шкалы MouseClick("left", 388, 72, 1, 0) ; Задаем цифры $i = 0 While $i <= 20 $i = $i + 1 if WinExists ("Color scale")=1 Then WinActivate('Color scale') ControlCommand('Color scale','','[CLASS:ComboBox; INSTANCE:1]','SetCurrentSelection',0) MouseClick("left", 867, 504, 1, 0) Send('{BACKSPACE 4}') Send($scale0) Send('{TAB}') Send($scale1) Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd MouseMove($aMPos[0], $aMPos[1], 0) EndFunc Func Button3() $aMPos = MouseGetPos() WinActivate('[REGEXPTITLE:Structure CAD]') ; Вызываем настройку шкалы MouseClick("left", 388, 72, 1, 0) ; Задаем цифры $i = 0 While $i <= 20 $i = $i + 1 if WinExists ("Color scale")=1 Then WinActivate('Color scale') ControlCommand('Color scale','','[CLASS:ComboBox; INSTANCE:1]','SetCurrentSelection',1) MouseClick("left", 867, 504, 1, 0) Send('{BACKSPACE 4}') Send($scale0) Send('{TAB}') Send($scale1) Send('{TAB}') Send($scale2) Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd MouseMove($aMPos[0], $aMPos[1], 0) EndFunc Func Button4() $aMPos = MouseGetPos() WinActivate('[REGEXPTITLE:Structure CAD]') ; Вызываем настройку шкалы MouseClick("left", 388, 72, 1, 0) ; Задаем цифры $i = 0 While $i <= 20 $i = $i + 1 if WinExists ("Color scale")=1 Then WinActivate('Color scale') ControlCommand('Color scale','','[CLASS:ComboBox; INSTANCE:1]','SetCurrentSelection',2) MouseClick("left", 867, 504, 1, 0) Send('{BACKSPACE 4}') Send($scale0) Send('{TAB}') Send($scale1) Send('{TAB}') Send($scale2) Send('{TAB}') Send($scale3) Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd MouseMove($aMPos[0], $aMPos[1], 0) EndFunc Func print() ;выполнение 10% GUICtrlSetData($button_print_status,10) ; Щелкаем "печать" в панели визуализации (кнопки должны быть в 3 столбца) WinActivate('[REGEXPTITLE:Structure CAD]') Sleep (10) WinActivate('Визуализация') $aMPos = MouseGetPos() MouseClick("left", 26, 766, 1, 0) MouseMove($aMPos[0], $aMPos[1], 0) ;выполнение 20% GUICtrlSetData($button_print_status,20) ; Текст комментариев берём из формы $i = 0 While $i <= 19 $i = $i + 1 if WinExists ("Текст комментариев для печати")=1 Then Send(GUICtrlRead($Text2)) Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd if $i = 20 Then GUICtrlSetData($button_print_status,0) Return EndIf ;выполнение 30% GUICtrlSetData($button_print_status,30) ; По умолчанию выбран принтер, использованный предыдущий раз $i = 0 While $i <= 19 $i = $i + 1 if WinExists ("[TITLE:Печать]", "Общие")=1 Then Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd if $i = 20 Then GUICtrlSetData($button_print_status,0) Return EndIf ;выполнение 40% GUICtrlSetData($button_print_status,40) ; Выбираем цветную печать $i = 0 While $i <= 19 $i = $i + 1 if WinExists ("SCAD")=1 Then Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd if $i = 20 Then GUICtrlSetData($button_print_status,0) Return EndIf ;выполнение 50% GUICtrlSetData($button_print_status,50) ; Как только появится окно pdf creator - нажимаем печать $i = 0 While $i <= 99 $i = $i + 1 if WinExists ("PDFCreator")=1 Then Sleep (1000) Send('{ENTER}') $i=101 EndIf Sleep (100) WEnd if $i = 100 Then GUICtrlSetData($button_print_status,0) Return EndIf ;выполнение 60% GUICtrlSetData($button_print_status,60) ; Вводим имя файла и сохраняем $i = 0 While $i <= 19 $i = $i + 1 if WinExists ("Сохранить как")=1 Then Sleep (500) Send(GUICtrlRead($Text)) Send('{ENTER}') $i=21 EndIf Sleep (100) WEnd if $i = 20 Then GUICtrlSetData($button_print_status,0) Return EndIf ; Увеличиваем порядковый номер на 1 GUICtrlSetData($Text, GUICtrlRead($Text)+1) GUICtrlSetData($button_print_status,100) ;выполнение 100% EndFunc Func About() MsgBox(0, "О программе", "Автор: Дмитрий Руденко" & @LF & "E-mail: 3952800@gmail.com" & @LF & "http://fordewind.org/" & @LF & "Программа распространяется бесплатно") EndFunc