Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/10/2020 in all areas

  1. I did a hardcore test out of curiosity. I generated a text file with 20.000 lines (1.360.000 bytes) and read it into my example (see above) ==> No problems ! Of course there will be a limit, but it seems to be very high .
    3 points
  2. Possible this way : $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, BitOr($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOPMOST+$WS_EX_LAYERED) GUISetBkColor(0xFFFF00) _WinAPI_SetLayeredWindowAttributes ($hGUI, 0xFFFF00)
    2 points
  3. Interesting indeed. Here my deductions. I think it relates to those 2 assertions : WinSetTrans($hGUI, "", xxx) seems to perform the same action as declaring the window WS_EX_LAYERED. So you can consider that your GUI has in fact that extended style, so the first assertion is applied. Since the background of pic is always transparent and you did not assign a file to the control, the whole GUI takes that property. To better show what I am trying to explain, lets take a few examples : $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, BitOr($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOPMOST+$WS_EX_LAYERED) GUISetBkColor($GUI_BKCOLOR_TRANSPARENT) ;WinSetTrans($hGUI, "", 255) ; or any value in this special context (?) $idPic = GUICtrlCreatePic("", 0, 0, 1, 1) ; strange GUICtrlCreatePic allows the transparency (?) Works as explained above. $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, BitOr($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOPMOST+$WS_EX_LAYERED) GUISetBkColor($GUI_BKCOLOR_TRANSPARENT) ;WinSetTrans($hGUI, "", 255) ; or any value in this special context (?) $idPic = GUICtrlCreatePic("Torus.jpg", 0, 0, 100, 100) ; strange GUICtrlCreatePic allows the transparency (?) Works only under the 100x100 pixels of the picture. Second assertion is proven right. $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, BitOr($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOPMOST+$WS_EX_LAYERED) GUISetBkColor($GUI_BKCOLOR_TRANSPARENT) ;WinSetTrans($hGUI, "", 255) ; or any value in this special context (?) $idPic = GUICtrlCreatePic("Torus.jpg", 0, 0, 1, 1) ; strange GUICtrlCreatePic allows the transparency (?) GUICtrlSetState (-1, $GUI_DISABLE) Does not work because of the left-top pixel (first assertion) cannot be used as the transparency color since the all the colors of the picture are all merged into a single pixel. So may not be that surprising after all.
    2 points
  4. No. You have to manage that yourself. And calling it a "pain" is a bit exaggerated, try programming it in ASM. You will see what pain looks like...
    2 points
  5. trancexx

    WinHTTP functions

    The other day mikeytown2 posted one post in HTTP UDF's thread that got me thinking if there is better (different) method to send requests through the HTTP protocol to HTTP servers. There is Winhttp.dll that ships with windows and that is its main purpose. I couldn't find any examples of using this dll in AutoIt, so I came up with this. Microsoft about Windows HTTP Services: Microsoft Windows HTTP Services (WinHTTP) provides developers with an HTTP client application programming interface (API) to send requests through the HTTP protocol to other HTTP servers... .. blah, blah, and so on... This is an example of getting page header: #include "WinHttp.au3" Opt("MustDeclareVars", 1) ; Open needed handles Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, "msdn.microsoft.com") ; Specify the reguest: Local $hRequest = _WinHttpOpenRequest($hConnect, Default, "en-us/library/aa384101(VS.85).aspx") ; Send request _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) Local $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header ; Clean _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Display retrieved header MsgBox(0, "Header", $sHeader)Everything you need to be able to use this UDF can be found at WinHttp site. Remember, basic understanding of the HTTP protocol is important to use this interface. ProgAndy, trancexx WinHttp.au3 is completely free and no one has right to charge you for it. That's very important. If you feel WinHttp.au3 was helpful to you and you wish to support my further work you can donate to my personal account via PayPal address: trancexx at yahoo dot com I will appreciate that very much. Thank you in advance! :kiss:
    1 point
  6. Compile your WebDriver script and use this one for grabbing the console : #include <Constants.au3> $pid = Run ("Test.exe", "", @SW_SHOW, $STDERR_MERGED) ProcessWaitClose ($pid) $sText = StdoutRead ($pid) MsgBox ($MB_SYSTEMMODAL,"",$sText) Works for me.
    1 point
  7. Not sure about limitless, but I ran a test with 50k as the limit and it worked as expected.
    1 point
  8. Is this topic related to your previous topic? If so, why did you start another topic? Also, why didn't you answer my question in the previous topic? Is it because you knew that harvesting data from the sites that you referred to above is prohibited by their terms of use which would also mean that helping you to do so here would be prohibited?
    1 point
  9. Melba23

    Adjust scrollbar range

    Andreik, Scrollbars work in character height and width units - not at all intuitive. Take a look at my Scrollbars UDF (the link is in my sig) and you will see how I went about trying to get them to work - or just use the UDF itself. M23
    1 point
  10. This also may be an option (with example) : #include <GUIConstantsEx.au3> #include <GuiEdit.au3> _Example() Func _Example() Local $idEdit, $sRead , $sFilename ; Example : Read GDIPlus.au3 and show the code in an Edit control : $sFilename = StringRegExpReplace(@AutoItExe, "(?i)AutoIt3.exe$", "") & "Include\GDIPlus.au3" $sRead = FileRead($sFilename) GUICreate("Test : Huge Edit Control", 1200, 600) $idEdit = GUICtrlCreateEdit("", 2, 2, 1194, 568) ; Gets the current text limit for an edit control ConsoleWrite('1. _GUICtrlEdit_GetLimitText($idEdit) = ' & _GUICtrlEdit_GetLimitText($idEdit) & @CRLF) ; Sets the text limit _GUICtrlEdit_SetLimitText($idEdit, 1500000) ConsoleWrite('2. _GUICtrlEdit_GetLimitText($idEdit) = ' & _GUICtrlEdit_GetLimitText($idEdit) & @CRLF) GUISetState(@SW_SHOW) _GUICtrlEdit_AppendText($idEdit, $sRead) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Example
    1 point
  11. GUICtrlSetLimit appears to be the solution to your issue.
    1 point
  12. Nine

    Context menu on listview item

    Here the way I would do it : #include <GUIConstants.au3> #include <GUIListView.au3> Global $idContextmenu = 0, $idSubmenu1 = 999, $idSubmenu2 = 999, $idSubmenu3 = 999 Global $winMain = GUICreate("Playlist", 400, 500, -1, -1, $WS_SIZEBOX) GUISetFont(9, 400, "", "Arial", $winMain) Global $ctrlView = GUICtrlCreateListView("File Names", 2, 2, 396, 450, _ BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $LVS_SINGLESEL, $LVS_AUTOARRANGE), _ BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) For $i = 1 To 9 _GUICtrlListView_AddItem($ctrlView, "FilePath " & $i) Next _GUICtrlListView_SetColumnWidth($ctrlView, 0, 375) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idSubmenu1 To $idSubmenu3 ConsoleWrite("submenu was selected" & @CRLF) EndSwitch WEnd Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) #forceref $hWnd, $MsgID, $wParam Local $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $GUI_RUNDEFMSG Local $code = DllStructGetData($tagNMHDR, 3) If $code = $NM_RCLICK Then If _GUICtrlListView_GetSelectedIndices($ctrlView) = "" Then GUICtrlDelete($idContextmenu) $idContextmenu = 0 ElseIf Not $idContextmenu Then $idContextmenu = GUICtrlCreateContextMenu($ctrlView) $idSubmenu1 = GUICtrlCreateMenuItem("Submenu 1", $idContextmenu) $idSubmenu2 = GUICtrlCreateMenuItem("Submenu 2", $idContextmenu) $idSubmenu3 = GUICtrlCreateMenuItem("Submenu 3", $idContextmenu) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
  13. The suitable place to post your demo would be, in my opinion, the forum area autoit-example-scripts Example scripts do not necessarily have to be huge projects like e.g. ISN AutoIt Studio. Even a small function can be beneficial for others .
    1 point
  14. ..I had children and had to give them names. Not easy. My spouses did that anyway ( and I had not much of a say anyway ) Now, coming up with names for concepts can get cumbersome and once you called it something it stays, even if you found a better name. I think the AdLib is a good name for the concept. It could be called Juan but, then again, people would say One, so.... AdLib it is ...and AdLib works like a timer but is not a timer. It will execute in the midst of the script every x ms. but is not a timer. Is an AdLib function. I can code something to show/proof the difference ( even if to add another shoe to my mouth )
    1 point
  15. Yes, but, you have to decide which data should be preferred. The data from the Array or the data from the ListView. Because if you change the data in the ListView, it is not automatically updated in the Array. The same is with the Array, if you modify the Array, the data is not automatically updated in the ListView. Until you update it. So here is the answer, on how to edit a Listview. There are few ways of doing it, and so i have chosen this one (without array) : #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $GUI_Main = GUICreate("SELL", 562, 327, 386, 141) GUICtrlCreateLabel("Name of dish", 8, 24, 70, 17) $Input_Name = GUICtrlCreateInput("", 80, 24, 113, 21) GUICtrlCreateLabel("Price", 230, 24, 50, 17) $Input_Price = GUICtrlCreateInput("", 280, 24, 129, 21) $Button_Edit = GUICtrlCreateButton("Save", 440, 24, 105, 25) $ListView_Sell = GUICtrlCreateListView("Name of dish|Price", 0, 64, 561, 257) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 250) $ListViewItem_Sellone = GUICtrlCreateListViewItem("Stir-fried noodles with beef|35$", $ListView_Sell) $ListViewItem_Selltwo = GUICtrlCreateListViewItem("Fried fish ball|10$", $ListView_Sell) $ListViewItem_Sellthree = GUICtrlCreateListViewItem("goby hotpot|50$", $ListView_Sell) GUISetState(@SW_SHOW) Global $fClick = 0, $iLV, $iRow, $iCol Global $itemEdited=-1 GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY_Handler") $hLV_1_Handle = GUICtrlGetHandle($ListView_Sell) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button_Edit if $itemEdited>-1 Then _GUICtrlListView_SetItemText($ListView_Sell,$itemEdited,GuiCtrlRead($Input_Name)) _GUICtrlListView_SetItemText($ListView_Sell,$itemEdited,GuiCtrlRead($Input_Price),1) ;~ GUICtrlSetData($Input_Name, "") ;~ GUICtrlSetData($Input_Price, "") ;~ $itemEdited=-1 ;~ _GUICtrlListView_SetItemSelected($ListView_Sell,-1,False) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch If $fClick Then ; Display result ConsoleWrite("Clicked LV: " & @TAB & $iLV & " Row: " & @TAB & $iRow & " Col: " & @TAB & $iCol & @CRLF) If $iRow > -1 Then $tmparray = _GUICtrlListView_GetItemTextArray($ListView_Sell, $iRow) If $tmparray[0] > 0 Then $itemEdited = $iRow GUICtrlSetData($Input_Name, $tmparray[1]) GUICtrlSetData($Input_Price, $tmparray[2]) EndIf $tmparray = "" EndIf ; Clear flag $fClick = 0 EndIf WEnd Func _WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) ;modified code from https://www.autoitscript.com/forum/topic/155607-how-to-detect-which-listview-was-clicked/ #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return Switch DllStructGetData($tStruct, 1) Case $hLV_1_Handle $iLV = 1 Case Else Return EndSwitch If BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) = $NM_CLICK Then $iRow = DllStructGetData($tStruct, 4) $iCol = DllStructGetData($tStruct, 5) ; Set flag $fClick = 1 EndIf EndFunc ;==>_WM_NOTIFY_Handler Click on a listview item to select it for editing, then change the text in the input boxes, and click on save to save it. Eventually, modify the Case $Button_Edit and remove comment from the commented lines to see a small change.
    1 point
  16. arryo, You might find this a bit quicker if your file is very large: $file = FileOpen("test.txt", 0) $read = FileRead($file) If @error = -1 Then MsgBox(0, "Error", "File not read") Exit Else MsgBox(0, "Read", $read) If StringRegExp($read, "Markus") Then MsgBox(0, "Oops", "Match") Else MsgBox(0, "Oops", "No match") EndIf EndIf FileClose($file)Although it does not give you the position. M23
    1 point
×
×
  • Create New...