Leaderboard
Popular Content
Showing content with the highest reputation on 01/16/2019 in all areas
-
Help file: You can not register a function using parameters.1 point
-
Take a look at _IELinkClickByText.1 point
-
Multiple arrays vs multidimensional array
JLogan3o13 reacted to Melba23 for a topic
DarkFingers1337, So here is your chance - do the benchmarking yourself so we can all share the result. Because I very much doubt anyone else is going to do it for you. M231 point -
Works fine for me, see test below: #include <Array.au3> #include <Excel.au3> Global $aBBTableData, $oExcel, $oWorkbook, $aSearchItems, $aSearchResult[0] $ChosenFileName = @ScriptDir & "\Test.xlsx" OpenExcelForCopy() Func OpenExcelForCopy() $oExcel = _Excel_Open() $oWorkbook = _Excel_BookOpen($oExcel, $ChosenFileName, Default, True, True) $oExcel.Sheets("CopyCourses").Activate ;~ Get all used cells in columns A and B <---- it this right? $aSearchItems = _Excel_RangeRead($oWorkbook, 1, $oWorkbook.Sheets("CopyCourses").Usedrange.Columns("A:B")) ;~ Create the $aSearchResult array ReDim $aSearchResult[UBound($aSearchItems)] ;~ Loop through the array starting at 0 until the end of the array which is (Ubound($aSearchItems) - 1) For $i = 0 To UBound($aSearchItems) - 1 ;~ Column 0 ConsoleWrite($aSearchItems[$i][0] & @CRLF) ;~ Column 1 ConsoleWrite($aSearchItems[$i][1] & @CRLF) $aSearchResult[$i] = CopyCourseNow($i, $aSearchItems[$i][0], $aSearchItems[$i][1]) ;~ Were going to put the results of our work into Column C Next _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") ;~ Finished() EndFunc ;==>OpenExcelForCopy Func CopyCourseNow($iIndex, $_sSearch, $sSearch1) Return Mod($iIndex, 2) = 0 ? "Odd" : "Even" EndFunc1 point
-
WinHTTP functions
coffeeturtle reacted to trancexx for a topic
Don't close session handle ($hOpen), reuse it for other connections or requests. Cookies are "properties" of sessions, and once set they are automatically resend for all subsequent requests until expired or session closed.1 point -
First find out what the index number is of the H3 object using the following code: #include <IE.au3> Local $oIE = _IECreate("konsalnet.pl", 1) _IELoadWait ($oIE) Local $oH3s = _IETagNameGetCollection($oIE, "h3") For $i = 0 To ($oH3s.Length - 1) ConsoleWrite("H3 Tag " & $i & ": " & $oH3s($i).InnerText & @CRLF) Next Once you know the index of the object you can use something like: #include <IE.au3> Local $oIE = _IECreate("konsalnet.pl", 1) _IELoadWait ($oIE) Local $oH3s = _IETagNameGetCollection($oIE, "h3") Local $oH3 = $oH3s(1) ;~ Formularz kontaktowy H3 tag _IEAction($oH3, "click")1 point
-
If you don't have text then, you need to identify the div, either by name, id or class name attributes, you may even have to select an element before it and use next/previous sibling. Example: #include <IE.au3> Local $oIE = _IECreate("konsalnet.pl", 1) _IELoadWait ($oIE) ;~ You would normally just use _IEGetObjById($oIE, "contact-form-btn") but just showing how to use h3 collection Local $oH3s = _IETagNameGetCollection($oIE, "h3") For $oH3 In $oH3s If $oH3.id = "contact-form-btn" Then ;~ Get the innertext from the div before the h3 tag ConsoleWrite($oH3.PreviousSibling.InnerText & @CRLF) EndIf ;~ Or you could use class name of the h3 tag as an identifier ;~ nb: Class names are generally not recommended unless you know that is the only H3 Tag with that class name. If $oH3.ClassName = "formularz-rozwin" Then ExitLoop _IEAction($oH3, "click") Next1 point
-
Send() in inactive window
HansHenrik reacted to Jefrey for a topic
You could use _WinAPI_PostMessage() and send WM_KEYDOWN to hold the key down, sleep some time and WM_KEYUP to release it. #include <WinAPISysWin.au3> #include <WindowsConstants.au3> $hWnd = WinGetHandle("Your window") $iVkCode = 0x45 ; A key, see https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes _WinAPI_PostMessage($hWnd, $WM_KEYDOWN, $iVkCode, 0) Sleep(100) _WinAPI_PostMessage($hWnd, $WM_KEYUP, $iVkCode, 0) However, please note that handling such messages is up to the receiving window. Some developers code their message receiving routine in such way that it only processes messages if their window is in foreground (active and in focus). Changing such behaviour is probably not possible with AutoIt, since you'd have to do some reversing on the application in order to hook and rewrite their message loop (and you would have to create a DLL for that). Additionally, Windows includes an additional LLKHF_INJECTED flag in keystrokes sent by other applications, if it's not a keyboard driver. Thus, an application can find out whether a keystroke came from the user's keyboard or it was simulated by another application (and block these inputs) simply by setting a low level keyboard hook and checking for that flag. In this case, you would have to develop a driver.1 point -
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 305, 212, 192, 124) $Tab1 = GUICtrlCreateTab(8, 8, 289, 193) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button1 = GUICtrlCreateButton("Go to Tab 2", 32, 56, 75, 25) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Button2 = GUICtrlCreateButton("Go to Tab 1", 33, 57, 75, 25) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetStyle($Tab1, $WS_DISABLED) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetState($TabSheet2, $GUI_SHOW) Case $Button2 GUICtrlSetState($TabSheet1, $GUI_SHOW) EndSwitch WEnd1 point
-
RC86, I would do something like this: #include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 305, 212, 192, 124) $Tab1 = GUICtrlCreateTab(8, 8, 289, 193) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button1 = GUICtrlCreateButton("Go to Tab 2", 32, 56, 75, 25) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Button2 = GUICtrlCreateButton("Go to Tab 1", 33, 57, 75, 25) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) Global $iSelectedTab = $TabSheet1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetState($TabSheet2, $GUI_SHOW) $iSelectedTab = $TabSheet2 Case $Button2 GUICtrlSetState($TabSheet1, $GUI_SHOW) $iSelectedTab = $TabSheet1 Case $Tab1 If GUICtrlRead($Tab1, 1) <> $iSelectedTab Then GUICtrlSetState($iSelectedTab, $GUI_SHOW) EndIf EndSwitch WEnd M231 point
-
Func OverlayWindow($hwndParent, $rectToHighlight, $rectForText, $textToWrite) $style = $WS_POPUP $exstyle = BitOR($WS_EX_TOPMOST, $WS_EX_TRANSPARENT, $WS_EX_LAYERED) $hGUI = GUICreate("transparent overlay", 420, 420, 0, 0, $style, $exstyle) GUISetBkColor(0x112233) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x112233, 0, $LWA_COLORKEY) ConsoleWrite("**** $hGUI: " & $hGUI & @CRLF) ...1 point