Что нового

[Автоматизация] Как взять тест из Label, нажать на Button, и открыть IE поиск с текстом из Label

Сообщения
1
Репутация
0
Как взять тест из Label, нажать на Button, и открыть IE поиск с текстом из Label&
Чтото том сделал для Button1 (думаю неправильно)
И забыл про Label Помогите пожалуйста
Вот код чтото начал поправьте что не так, и добавьте желаемый результат
Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Google Поиск", 358, 57, 192, 114)
GUICtrlCreateInput("", 8, 16, 257, 21)
$Button1 = GUICtrlCreateButton("Начать поиск!", 264, 16, 83, 25)
$Label1 = GUICtrlCreateLabel("Google поисковик", 80, 0, 95, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		 Case $Label1
			
		 Case $Button1
			#include <IE.au3>
			$oIE = _IECreate()
			
	EndSwitch
WEnd
 

WSWR

AutoIT Гуру
Сообщения
941
Репутация
363
Re: [Автоматизация] Как взять тест из Label, нажать на Button, и открыть IE поиск с текстом из Labe

Андрей Баканов

Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#include <IE.au3>
#include <Array.au3>

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Google Поиск", 358, 57, 192, 114)
$Input1 = GUICtrlCreateInput("", 8, 16, 257, 21)
$Button1 = GUICtrlCreateButton("Начать поиск!", 264, 16, 83, 25)
GUICtrlCreateLabel("Google поисковик", 80, 0, 95, 17)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

Global $oIE = ''

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			$sText = GUICtrlRead($Input1) ; читаем текст из $Input1
			If $sText <> '' Then ; проверяем, не пустая ли строка
				If Not IsObj($oIE) Then ; проверяем, был ли запущен браузер IE
					$oIE = _IECreate('http://www.google.ru/search?q=' & $sText) ; если нет, запускаем
				Else
					_IENavigate($oIE, 'http://www.google.ru/search?q=' & $sText); если IE запущен, переходим по ссылке
				EndIf
			EndIf
	EndSwitch
WEnd
 
Верх