|
Компьютерный форум OSzone.net » Программирование, базы данных и автоматизация действий » AutoIt » [архив - Часть 2] AutoIt скрипты |
|
[архив - Часть 2] AutoIt скрипты
|
(*.*) Сообщения: 36568 |
Внимание! Тема переведена в архивное состояние Текущая тема http://forum.oszone.net/thread-98914.html (настоятельно рекомендуется к прочтению/поиску) Руководство к действию по работе c AutoIt. ![]() Сайт программы Русская справка Коллекция AutoIt скриптов от Sanja Alone Коллекция AutoIt скриптов от MSFN (могут быть устаревшие). Справочник по командам rundll32 (команды запуска диалоговых окон и не только...) AutoIt скрипты - введение и FAQ (статья содержит вводную информацию по AutoIt, а также ответы на ЧаВо). Данная тема предназначена для общих вопросов по AutoIt. Вопросы по установке приложений при помощи AutoIt следует задавать в соответствии с правилами форума "Автоматическая установка приложений". Таким образом, если вы хотите узнать как установить Winamp 5.x при помощи AutoIt, то создайте тему [autoit] Winamp 5.х (если таковой еще нет на форуме). Проверить наличие тем можно при помощи поиска или фильтров. Цитата Vadikan:
|
||
------- Отправлено: 00:02, 05-02-2006 |
Ветеран Сообщения: 604
|
Профиль | Отправить PM | Цитировать Creat0R
Цитата:
![]() |
|
------- Отправлено: 06:53, 06-12-2007 | #821 |
Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети. Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля. |
Ветеран Сообщения: 604
|
Профиль | Отправить PM | Цитировать В новой версии кол-во UDF увеличилось, что не может не радовать, но увеличилось также кол-во вопросов. :-)
Взять к примеру Цитата:
#include <GuiConstants.au3> #include <GuiListView.au3> $Gui = GUICreate("Test", 300, 200) $hListView = _GUICtrlListView_Create($GUI, "Items|SubItems", 2, 2, 296, 196, BitOR($LVS_EDITLABELS, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) $ListItem1 = _GUICtrlListView_AddItem($hListView, "Item1") $ListItem2 = _GUICtrlListView_AddItem($hListView, "Item2") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_BEGINLABELEDIT Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam) Return False Case $LVN_ENDLABELEDIT Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam) Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text")) If StringLen(DllStructGetData($tBuffer, "Text")) Then Return True EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc |
|
Отправлено: 10:11, 06-12-2007 | #822 |
Must AutoIt Сообщения: 3054
|
Профиль | Сайт | Отправить PM | Цитировать Maza Faka
По поводу Toolbar'а... Вот простенький пример (примитивного уровня)... ![]() #include <GuiConstants.au3> $Gui = GuiCreate("Splitter Bar", 200, 70) $Menu = GUICtrlCreateMenu("Menu") GUICtrlCreateMenuItem("Item", $Menu) GuiCtrlCreateSeperator(0, 3, 5, 3, 195) $Left = 7 $IconsArr = StringSplit("13|23|25|169|28", "|") For $i = 1 To $IconsArr[0] $ControlID = GUICtrlCreateButton("", $Left, 10, 24, 24, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", $IconsArr[$i], 0) If $i < $IconsArr[0] Then GuiCtrlCreateSeperator(1, $Left + 30, 10) $Left += 40 Next GuiCtrlCreateSeperator(0, 3, 40, 3, 195) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3, $ControlID Exit EndSwitch WEnd Func GuiCtrlCreateSeperator($Direction, $Left, $Top, $Width=3, $Lenght=25) Switch $Direction Case 0 GUICtrlCreateLabel("", $Left, $Top, $Lenght, $Width, $SS_SUNKEN) Case 1 GUICtrlCreateLabel("", $Left, $Top, $Width, $Lenght, $SS_SUNKEN) EndSwitch EndFunc ![]() |
------- Отправлено: 21:13, 06-12-2007 | #823 |
Ветеран Сообщения: 604
|
Профиль | Отправить PM | Цитировать Creat0R
Цитата:
![]() ![]() |
|
------- Отправлено: 06:33, 07-12-2007 | #824 |
Новый участник Сообщения: 14
|
Профиль | Отправить PM | Цитировать Подскажите, пожалуйста, как можно переключатся по закладкам и выбрать нужный компонент в подобном окне (свойство "Подключение по локальной сети") без использования имитации нажатия клавиш и мыши. Дело в том что число компонентов и закладок может изменятся, поэтому иметация нажатия уже будет не попадать.
|
Отправлено: 17:10, 07-12-2007 | #825 |
Пользователь Сообщения: 143
|
Профиль | Отправить PM | Цитировать А как написать, что бы можно было копировать папки/фалы с сдрома, незная буквы CD? можно ли такое сделать на AUTO IT.
Спасибо. |
Последний раз редактировалось HORRIBLE, 07-12-2007 в 22:03. Отправлено: 21:06, 07-12-2007 | #826 |
![]() Пользователь Сообщения: 88
|
Профиль | Отправить PM | Цитировать Цитата fak1r:
Вот автовход на сайт : www.nn.ru #include <IE.au3> $oIE = _IECreate ("http://www.nn.ru/popup.php?c=classUsers&m=forum&s=&users_do=enter") $oForm = _IEFormGetCollection ($oIE, 0); MsgBox(0,"",$oForm,1) $oQuery0 = _IEFormElementGetCollection ($oForm, 0) _IEFormElementSetValue ($oQuery0, "Login") $oQuery1 = _IEFormElementGetCollection ($oForm, 1) _IEFormElementSetValue ($oQuery1, "E-Mail") $oQuery2 = _IEFormElementGetCollection ($oForm, 2) _IEFormElementSetValue ($oQuery2, "123456") _IEFormSubmit ($oForm) |
|
Отправлено: 22:39, 07-12-2007 | #827 |
Must AutoIt Сообщения: 3054
|
Профиль | Сайт | Отправить PM | Цитировать Kenwood3D,
Для переключения вкладок, можно использовать мою UDF _ControlTab(), и указывать текст в качестве идентификатора... Т.к я изменил функцию, вылажу её ещё раз чуть ниже (не помещается) - добавлена возможность выбора определённого таба ("TabSelect"), и для TabRight/TabLeft теперь можно указывать дополнительный пареметр, определяющий сколько сдвигов следует сделать вправо/влево: $ConnPropTitle = 'Подключение по локальной сети' $TabText = "Проверка" _OpenConnProperties($ConnPropTitle) WinWait($ConnPropTitle) $iIndex = _ControlTab($ConnPropTitle, "", "FindTab", $TabText, "", True) _ControlTab($ConnPropTitle, "", "TabSelect", $iIndex) Sleep(2500) Func _OpenConnProperties($sConnName) Local $oShellApp = ObjCreate('shell.application') Local $oCP = $oShellApp.Namespace (3), $Item For $Item In $oCP.Items If $Item.name = 'Сетевые подключения' Then For $Item In $Item.Getfolder.Items If $Item.name = $sConnName Then $Item.InvokeVerb ('Сво&йства') Next EndIf Next EndFunc HORRIBLE Цитата:
|
|
------- Отправлено: 00:07, 08-12-2007 | #828 |
Must AutoIt Сообщения: 3054
|
Профиль | Сайт | Отправить PM | Цитировать Функция _ControlTab():
;=============================================================================== ; Function Name: _ControlTab() ; Description: Sends a command to a SysTab32 Control. ; Syntax: _ControlTab ( $hWnd, $sText, $sCommand [, $sParam1 [, $sParam2 [, $sParam3]]] ) ; ; Parameter(s): $hWnd = Window Handle/Title. ; $sText = Window Text. ; $sCommand = Command to send to the control (See "Return Value(s)"). ; $sParam1, $sParam2, $sParam3 = Additional parameters required by some commands. ; ; Requirement(s): None. ; ; Return Value(s): Depends on command as shown below. In case an invalid command or window/control, @error set to 1 and return "" ; If $sCommand Equel... ; "GetItemState" - State of the tab item returned. ; ($sParam1 defines what tab item (zero-based) will be used - 0 is the default). ; On failure return "" and set @error to 1. ; ; "GetItemText" - Text of the tab item returned. ; ($sParam1 defines what tab item (zero-based) will be used - 0 is the default). ; On failure return "" and set @error to 1. ; ; "GetItemImage" - Image Index of the tab item returned. ; ($sParam1 defines what tab item (zero-based) will be used - 0 is the default). ; On failure return "" and set @error to 1. ; ; "CurrentTab" - Returns the current Tab shown of a SysTabControl32. ; On failure return -1 and set @error to 1. ; ; "TabRight" - Moves to the next tab to the right of a SysTabControl32. ; ($sParam1 defines how many times move to the right tab - 1 is the default). ; On failure return -1 and set @error to 1. ; ; "TabLeft" - Moves to the next tab to the left of a SysTabControl32. ; ($sParam1 defines how many times move to the left tab - 1 is the default). ; On failure return -1 and set @error to 1. ; ; "TabSelect" - Select specific tab item (base on given zero-based index) of a SysTabControl32. ; On failure return -1 and set @error to 1. ; ; "GetTabsCount" - Returns the number of total tab items of a SysTabControl32. ; On failure return -1 and set @error to 1. ; ; "FindTab" - Search For tab item with specific text.. ; In this case used all three additional parameters: ; $sParam1 - defines what text to find. ; $sParam2 - defines from what tab item the search will start (zero-based). ; $sParam3 - defines search type... ; If $sParam3 = True Then will be performed a partial search of the string in the tab item text. ; On seccess: return the tab item index taht contain founded text. ; On failure: ; If $sParam2 >= total tabs count, return -1 and set @error to 1. ; If could not find tab, return -1. ; ; Author(s): G.Sandler a.k.a CreatoR ; ; Example(s): ; $TabText = _ControlTab("Properties", "", "GetItemText", 1) ;Will return the text of second tab from the left side. ;=============================================================================== Func _ControlTab($hWnd, $sText, $sCommand, $sParam1="", $sParam2="", $sParam3="") Local Const $TCM_FIRST = 0x1300 Local $hTab = ControlGetHandle($hWnd, $sText, "SysTabControl321") Switch $sCommand Case "GetItemState", "GetItemText", "GetItemImage" Local Const $TagTCITEM = "int Mask;int State;int StateMask;ptr Text;int TextMax;int Image;int Param" Local Const $TCIF_ALLDATA = 0x0000001B Local Const $TCM_GETITEM = $TCM_FIRST + 5 Local $tBuffer = DllStructCreate("char Text[4096]") Local $pBuffer = DllStructGetPtr($tBuffer) Local $tItem = DllStructCreate($tagTCITEM) Local $pItem = DllStructGetPtr($tItem) DllStructSetData($tItem, "Mask", $TCIF_ALLDATA) DllStructSetData($tItem, "TextMax", 4096) DllStructSetData($tItem, "Text", $pBuffer) If $sParam1 = -1 Or $sParam1 = "" Then $sParam1 = _ControlTab($hWnd, $sText, "CurrentTab") If @error Then Return SetError(1, 0, "") EndIf DllCall("user32.dll", "long", "SendMessage", "hwnd", $hTab, "int", $TCM_GETITEM, "int", $sParam1, "int", $pItem) If @error Then Return SetError(1, 0, "") If $sCommand = "GetItemState" Then Return DllStructGetData($tItem, "State") If $sCommand = "GetItemText" Then Return DllStructGetData($tBuffer, "Text") If $sCommand = "GetItemImage" Then Return DllStructGetData($tItem, "Image") Case "CurrentTab" Local $iRet = ControlCommand($hWnd, $sText, "SysTabControl321", $sCommand, "") If @error Then Return SetError(1, 0, -1) Return $iRet - 1 Case "TabRight", "TabLeft" Local $iRet = 0 If Not IsNumber($sParam1) Or $sParam1 <= 0 Then $sParam1 = 1 For $i = 1 To $sParam1 $iRet = ControlCommand($hWnd, $sText, "SysTabControl321", $sCommand, "") If @error Then Return SetError(1, 0, -1) Next Return $iRet Case "TabSelect" Local Const $TCM_SETCURFOCUS = $TCM_FIRST + 48 Local $iRet = DllCall("user32.dll", "long", "SendMessage", _ "hwnd", $hTab, "int", $TCM_SETCURFOCUS, "int", $sParam1, "int", 0) If @error Then Return SetError(1, 0, -1) Return $iRet[0] Case "GetTabsCount" Local Const $TCM_GETITEMCOUNT = $TCM_FIRST + 4 Local $iRet = DllCall("user32.dll", "long", "SendMessage", "hwnd", $hTab, "int", $TCM_GETITEMCOUNT, "int", 0, "int", 0) If @error Then Return SetError(1, 0, -1) Return $iRet[0] Case "FindTab" If Not IsNumber($sParam2) Or $sParam2 < 0 Then $sParam2 = 0 Local $sTabText Local $iCnt = _ControlTab($hWnd, $sText, "GetTabsCount") If $sParam2 >= $iCnt Then Return SetError(1, 0, -1) For $i = $sParam2 To $iCnt $sTabText = _ControlTab($hWnd, $sText, "GetItemText", $i) If $sParam3 = True And StringInStr($sTabText, $sParam1) Then Return $i If $sTabText = $sParam1 Then Return $i Next Return -1 Case Else Return SetError(1, 0, "") EndSwitch EndFunc ;==> _ControlTab |
------- Отправлено: 00:10, 08-12-2007 | #829 |
Must AutoIt Сообщения: 3054
|
Профиль | Сайт | Отправить PM | Цитировать amel27,
Мы мучались с DllCallBack (чтобы скрипт не останавливался на момент перемещения окна), когда можно было просто использовать обычный GUIRegisterMsg($WM_TIMER, "WM_TIMER") ![]() Инфу чисто случайно откопал из скрипта “Network profiles” (на оф. форуме) ... #include <GuiConstants.au3> Global Const $WM_TIMER = 0x0113 $Gui = GuiCreate("_TimerFunc Test", 300, 130) $Left = -200 $Label = GUICtrlCreateLabel("Drag the window, i am just a runing text ;)", $Left, 100) $RunCheckBox = GUICtrlCreateCheckbox("Run text", 20, 40) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 _AdlibDisable($Gui) Exit Case $RunCheckBox If GUICtrlRead($RunCheckBox) = 1 Then _AdlibEnable("_TimerFunc", $Gui, 30) Else _AdlibDisable($Gui) EndIf EndSwitch WEnd Func _AdlibEnable($sFunction, $hWnd, $iTime=250) GUIRegisterMsg($WM_TIMER, $sFunction) DllCall("User32.dll", "int", "SetTimer", "hwnd", $hWnd, "int", 50, "int", $iTime, "int", 0) EndFunc Func _AdlibDisable($hWnd) GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int_ptr", 50) EndFunc Func _TimerFunc() $Left += 2 If $Left >= 300 Then $Left = -200 ControlMove($Gui, "", $Label, $Left, 100) EndFunc |
------- Отправлено: 06:41, 08-12-2007 | #830 |
![]() |
Участник сейчас на форуме |
![]() |
Участник вне форума |
![]() |
Автор темы |
![]() |
Сообщение прикреплено |
| |||||
Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
Открывая 7z архив пишет не удаётся открыть как архив. Можно ли его восстановить? | DreDo | Хочу все знать | 4 | 01-12-2009 18:54 | |
[Архив - Часть 3] AutoIt скрипты .:[общие вопросы]:. | Vadikan | AutoIt | 1543 | 18-01-2009 10:46 | |
[Архив - Часть 1.3] AutoIt скрипты | biork | AutoIt | 503 | 09-06-2007 11:27 | |
[Архив - Часть 1.2] AutoIt скрипты | Dirk Diggler | AutoIt | 505 | 02-12-2006 11:00 | |
[Архив - Часть 1.1] AutoIt скрипты | EgOrus | AutoIt | 335 | 04-02-2006 16:58 |
|