Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/27/2023 in all areas

  1. pixelsearch

    Infinite scroll

    @mutleey If it was me, I would use the left click only for the infinite scroll. Because if you use the left click for both scrolling and selecting a pic, then things could mix up and harder to script. If you want infos on a pic, you could right click on the pic, get its id (via a registered WM_COMMAND) then display its infos, without the need of GUIOnEventMode. Based on Nine's script, here is how I would get the right-clicked pic id via WM_COMMAND . The pic id is displayed in Scite Console, from 3 to 155 in this example, e.g. 153 pics, with 3 being the smallest control id in a GUI. Here, as the 1st control created is GUICtrlCreatePic, then 3 is corresponds to the 1st pic, but it won't always be like that, in case you created other controls before the 1st GUICtrlCreatePic. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <Misc.au3> #include <GUIScrollBars_Ex.au3> ; Melba23's Global $aButton[51], $bButton[51], $cButton[51], $g_idPicSelected = 0 ; Create GUI $hGUI_Main = GUICreate("", 792, 1080, -1, 0, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0xFFAAAA) For $i = 0 To 50 $aButton[$i] = GUICtrlCreatePic("mp3.jpg", 6, 10 + (262 * $i), 250, 250) $bButton[$i] = GUICtrlCreatePic("mp3.jpg", 262, 10 + (262 * $i), 250, 250) $cButton[$i] = GUICtrlCreatePic("mp3.jpg", 518, 10 + (262 * $i), 250, 250) Next _GUIScrollBars_Generate($hGUI_Main, 0, 10 + (262 * $i)) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW, $hGUI_Main) Local $iPos, $iY While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN ; left click $iPos = MouseGetPos(1) $iY = $iPos While _IsPressed("01") If $iPos = MouseGetPos(1) Then ContinueLoop $iPos = MouseGetPos(1) If $iPos < $iY Then For $i = 1 To Int(($iY - $iPos) / 15) _SendMessage($hGUI_Main, $WM_VSCROLL, $SB_LINEDOWN) Next Else For $i = 1 To Int(($iPos - $iY) / 15) _SendMessage($hGUI_Main, $WM_VSCROLL, $SB_LINEUP) Next EndIf If $i > 1 Then $iY = $iPos WEnd Case $GUI_EVENT_SECONDARYDOWN ; right click MouseClick("") ; computer performs a left click to trigger WM_COMMAND and get the id of the right-clicked pic. ConsoleWrite($g_idPicSelected & @crlf) EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) $g_idPicSelected = BitAND($wParam, 0xFFFF) ; Low Word (control id) Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Now as you intend to display the infos in a new GUI, then you probably need to use the advanced GUIGetMsg() with a parameter = 1 , to know exactly which GUI is concerned when you click inside it, close it etc... or you could disable the main GUI while the infos appear in the secondary GUI, there are plenty of options. Good luck
    1 point
  2. Ah I think this may have been it. The pipes shouldn't be there, of course, that threw me off, but I tried with this simpler example: $spintext = "{Hello{ooo| There}|Hi}, how's it going?" And got: Helloooo, how's it going? Hi, how's it going? Hi, how's it going? Hello There, how's it going? So yeah, script works, the input string in the example isn't valid spintax :) For future reference, a working script an example for nested spintax in Autoit: ;Spintax Test #include <Array.au3> ; Text in Spintax format ;~ Global $a = 1 $spintext = "{Hello{ooo| There}|Hi}, how's it going?" ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) ConsoleWrite(Spintax($spintext) & @CRLF) Func Spintax($sInput) ;~ ConsoleWrite("- Iteration "&$a&" Start -" & @CRLF) $SpinArray = StringRegExp($sInput, '{([^{]*?|[^{]*?)}',3); Global matches ;~ _ArrayDisplay($SpinArray,"") $sfinrep = StringReplace($sInput,"}|{","|") ; look For final replacing If Not IsArray($SpinArray) Then ;~ ConsoleWrite("!No Array!" & @CRLF) If $sfinrep = $sInput then ; Nothing replaced, so free of }|{ --> end string ;~ ConsoleWrite("+EndResult: " & @CRLF) Return $sInput EndIf ;else replace workstring with the string without }|{ for further processing $sInput = $sfinrep $SpinArray = StringRegExp($sInput, '{([^{]*?|[^{]*?)}',3); Global matches ;~ ConsoleWrite("final replaced string:" & @CRLF) ;~ ConsoleWrite($sInput & @CRLF) EndIf $TrimmedText = StringRegExpReplace($sInput, '{([^{]*?|[^{]*?)}',chr(0x1A)); or any other special char to mark where to insert $RNDText = $TrimmedText For $i = 0 To UBound($SpinArray)-1 $WordArray = StringSplit($SpinArray[$i], "|",3) $rnum = Random(0, UBound($WordArray)-1, 1); get random Array index $RNDText = StringReplace($RNDText, chr(0x1A), $WordArray[$rnum],1); replace only the next occurrence Next ;~ ConsoleWrite($RNDText & @CRLF) ;~ ConsoleWrite("- Iteration "&$a&" End -" & @CRLF) ;~ $a += 1 Return Spintax($RNDText) EndFunc Thanks @qsek and @water :)
    1 point
  3. I have already run this code and - as far as I can tell - the result doesn't look bad. I tested your first result Hello World!|Greetings Everyone, C++ is an awesome|n astonishing programming language. and to me it looks correct. I understand the "extra" pipe character after "World!" and "|n" after "awesome" to be correct as they are - as far as I understand the Spintax syntax - literals. So maybe the input string isn't fully correct? Or it is me
    1 point
  4. Which of the code examples did you try? The one by svenadamsson or the one by qsek?
    1 point
  5. The way I do it is to have curl store each response in a file whose file name uniquely identifies the request and then process the files accordingly. Longer explanation below:
    1 point
  6. @Gianni Grazie mille. I will have a deeper look tomorrow. Btw, here the SHCreateStreamOnFileEx function: ;Coded by UEZ build 2023-08-28 #include <WinAPIFiles.au3> Const $STGM_FAILIFTHERE = 0, $STGM_DIRECT = 0, $STGM_READ = 0, $STGM_WRITE = 1, $STGM_READWRITE = 2, _ $STGM_SHARE_DENY_NONE = 0x00000040, $STGM_SHARE_DENY_READ = 0x00000030, $STGM_SHARE_DENY_WRITE = 0x00000020, $STGM_SHARE_EXCLUSIVE = 0x00000010, _ $STGM_PRIORITY = 0x00040000, $STGM_CREATE = 0x00001000, $STGM_CONVERT = 0x00020000, _ $STGM_TRANSACTED = 0x00010000, $STGM_NOSCRATCH = 0x00100000, $STGM_NOSNAPSHOT = 0x00200000, $STGM_SIMPLE = 0x08000000, $STGM_DIRECT_SWMR = 0x00400000, $STGM_DELETEONRELEASE = 0x04000000 ;https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-shcreatestreamonfileex Func _WinAPI_SHCreateStreamOnFileEx($sFile, $grfMode, $dwAttributes, $fCreate) Local $iLen = StringLen($sFile) If Not $iLen Then Return SetError(1, 0, 0) Local $tFile = DllStructCreate("wchar szFile[" & $iLen & "]") $tFile.szFile = $sFile Local $aResult = DllCall("Shlwapi.dll", "long", "SHCreateStreamOnFileEx", "struct*", $tFile, "dword", $grfMode, "dword", $dwAttributes, "bool", $fCreate, "ptr", Null, "ptr*", 0) If $aResult[0] Or @error Then Return SetError(2, $aResult[0], 0) Return $aResult[6] EndFunc Global $hStream = _WinAPI_SHCreateStreamOnFileEx('c:\temp\SShot.jpg', BitOR($STGM_READWRITE, $STGM_CREATE), $FILE_ATTRIBUTE_NORMAL, True)
    1 point
  7. I understand. Have no idea how to help you. Sorry.
    1 point
  8. Hi September I hope you find someone being able to do it with a list control (e.g. GUICtrlCreateList) Meanwhile, here is the easy way to do it with a listview control. Who knows, it may help you in case you want to try a "no header listview control with 1 column only" looking like a list control. #include <GUIConstantsEx.au3> #include <GuiListView.au3> Example() Func Example() Local $hGUI = GUICreate("Alternate color in LV", 270, 175, 100, 200) Local $idListview = GUICtrlCreateListView("", 10, 10, 250, 155, $LVS_NOCOLUMNHEADER) _GUICtrlListView_AddColumn($idListview, "", 228) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) ; <============ GUICtrlSetBkColor(-1, 0xFFFFFF) ; white background (will show on odd lines) For $i = 1 To 20 GUICtrlCreateListViewItem("Line " & $i, $idListview) GUICtrlSetBkColor(-1, 0xE6E6E6) ; light grey background (will show only on even lines) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example
    1 point
  9. Correct, although there still could be a little difference depending on the used directives. Aut2exe normally does the adding of all includefiles and stripping of the directives and commentlines, which is now already done by au3stripper, except the directives which are still required by aut2exe.
    1 point
  10. 1 point
  11. Jos

    send a mail with Autoit

    Does your t-mobile account use 2 step authentication? If so does it also allow for "insecure apps" to set up another password, as that would then be required for this to work? Use that is that is available.
    1 point
×
×
  • Create New...