-
Posts
2,662 -
Joined
-
Last visited
-
Days Won
36
Gianni's Achievements
-
hudsonhock reacted to a post in a topic: Read data from html Tables from raw HTML source
-
Gianni reacted to a post in a topic: The Excel Button Calc Spreadsheet v2
-
you can set the path for that directory in the second parameter of the "CreateCoreWebView2EnvironmentWithOptions" function call. That path must be writable or else an error will be thrown. take a look here: https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/?do=findComment&comment=1475295 ... and also here: What is the 'EBWebView' folder created for? · Issue #2023 · MicrosoftEdge/WebView2Feedback · GitHub
-
Gianni reacted to a post in a topic: How to avoid MS defenders to delete executable file created.
-
Gianni reacted to a post in a topic: Need help to make a 4k video player
-
Gianni reacted to a post in a topic: Need help to make a 4k video player
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
Hi @MattyD,First of all, thank you for this work you are doing. From a first look at the WinRT UDF, I see that the _WinRT_WaitForAsync function is used to block the execution of the main script until the expected event is raised (or expires). I would like to ask you if there is a way to use something similar to the AutoIt ObjEvent() function as an alternative (or maybe, even better, use that function directly). That is, give the user the possibility to pass the name of their own function attached to an event that will be called asynchronously when that event occurs? I apologize in advance if I misunderstood the mechanism of the _WinRT_WaitForAsync() function ... bye and thank you
-
Gianni reacted to a post in a topic: WinRT Object Libraries
-
bdr529 reacted to a post in a topic: _ArrayUnique on multiple columns
-
ioa747 reacted to a post in a topic: Microsoft Edge - WebView2, embed web code in your native application
-
ioa747 reacted to a post in a topic: Microsoft Edge - WebView2, embed web code in your native application
-
with the changes suggested by @UEZ it works for me try putting #AutoIt3Wrapper_UseX64=n at the beginning of the script
-
Hi @Blaxxun, ... if you want to try something similar you can take a look at my _crop() function found here: https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool Below is a simple script if you're interested in trying it out. I hope it can be of use to you. #include <GUIConstantsEx.au3> #include <croptool.au3> ; <-- https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool Opt("GUICloseOnESC", 0) ; Simple example of use of the _Crop() function ; ; it allows you to freely and visually select an area of the screen ; ; - To resize the area click the left mouse button on any of the moving colored edges of the tool and drag. ; You can also LeftClick within the selected area and drag to move the whole selector. ; ; - To terminate the selection operation RightClick within the selected area. ; ; You can alse terminate the selection operation by hitting the ESC key; ; in that case the @extended macro will be setted to true Example() Func Example() ; Create an example GUI Local $hGui = GUICreate("Crop Demo", 220, 105, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) ; Create buttons Local $Crop = GUICtrlCreateButton("Start cropping", 10, 10, 200, 25) Local $Crop_hide_me = GUICtrlCreateButton("Hide me and crop", 10, 40, 200, 25) Local $Close = GUICtrlCreateButton("Close", 10, 70, 200, 25) ; Display the example GUI GUISetState(@SW_SHOW, $hGui) Local $aSelection = 0, $bExtended = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Close ExitLoop Case $Crop ; start the crop tool $aSelection = _crop() $bExtended = @extended Case $Crop_hide_me ; hide this gui and start the crop tool GUISetState(@SW_HIDE, $hGui) $aSelection = _crop() $bExtended = @extended GUISetState(@SW_SHOW, $hGui) EndSwitch If $bExtended Then MsgBox(48, "Esc pressed", "no crop area selected") $aSelection = '' $bExtended = 0 EndIf If IsArray($aSelection) Then MsgBox(64, 'Coordinates of the selected area', _ "UpperLeft X : " & $aSelection[0] & @CRLF & _ "UpperLeft Y : " & $aSelection[1] & @CRLF & _ "Width : " & $aSelection[2] & @CRLF & _ "Height : " & $aSelection[3]) $aSelection = '' EndIf WEnd ; Delete the GUI GUIDelete($hGui) EndFunc ;==>Example
-
ShellExecute('ms-teams.exe')
-
Get all computers connected to the router
Gianni replied to AutID's topic in AutoIt General Help and Support
hi @casi4711 the address "192.168.178" is incomplete and represents neither a range nor a single address. What address range do you intend to ping? For example, if you want to ping all addresses from 192.168.178.0 to 192.168.178.255 then you can use this range value "192.168.178.*" the asterisk indicates all possible values (0 to 255) for other possible examples of valid ranges take a look here: https://www.autoitscript.com/forum/topic/156395-versatile-multi-ping -
Get all computers connected to the router
Gianni replied to AutID's topic in AutoIt General Help and Support
Hi @casi4711 here's a "quick and dirty" modification to the above script that should achieve what you're asking for when you double-click on a "computer". I hope it is useful to you bye ; this is to ping continuously a list of IP addresses, get and display ping result "live" ; it simulates the dos "ping -t" command but performed simultaneously on many IP ; presenting the results in a ListView highlighting not responding devices with a red box #include <GUIConstantsEx.au3> #include <Array.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListviewConstants.au3> #include <WindowsConstants.au3> #include 'MultiPing.au3' ; <-- take this from the following link : ; http://www.autoitscript.com/forum/topic/156395-versatile-multi-ping Global $listview, $hLV_Handle, $iRow, $bClick = False _IP_Scanner() Func _IP_Scanner($IP_range = '', $IP_mask = '') ; Local $IP_range = "" ; range to be pinged (leave it empty to ping all local lan) ; Local $IP_mask = "" Local $sClickedItemText Opt("GUIOnEventMode", 1) HotKeySet("{esc}", "_button1") Local $Win_X = 600, $Win_Y = 600 ; dimension of window Local $PingGui = GUICreate("IP addresses monitor", $Win_X, $Win_Y, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_button1", $PingGui) $listview = GUICtrlCreateListView("", 10, 10, $Win_X - 20, $Win_Y - 40) $hLV_Handle = GUICtrlGetHandle($listview) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY_Handler") GUICtrlSetFont(-1, 6) GUICtrlSetStyle($listview, $LVS_ICON + $LVS_NOLABELWRAP) ; Generate colored square images $hImage = _GUIImageList_Create(16, 16) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 16, 16)) ; yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 16, 16)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 16, 16)) ; green _GUICtrlListView_SetImageList($listview, $hImage, 0) $button1 = GUICtrlCreateButton("Exit", 10, $Win_Y - 25, $Win_X - 20, 20) GUICtrlSetTip(-1, "End of program") GUICtrlSetOnEvent(-1, "_button1") GUISetState(@SW_SHOW) $MyArray = _nPing($IP_range, $IP_mask, 1, 1) ; first call is to generate the array ; this will search for all active IP devices ; and make a "snapshot" in the $MyArrat _ArrayDelete($MyArray, 0) ; remove first item ; _ArrayDisplay($MyArray) _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_AddArray($listview, $MyArray) ; and fill ListView _GUICtrlListView_EndUpdate($listview) While 1 ; continuously ping addresses of the snapshot previously generated Sleep(10) _nPing($MyArray, 0, 0, 0, "_refresh") ; PING required addresses and call the _refresh() function ; for each terminated ping (reasults of ping are passed to function) ; ; ------------------------------------------------------ ; ---- manage your click (doubleclick) action here below ; ------------------------------------------------------ If $bClick Then $bClick = False ; clear the flag immediately $sClickedItemText = _GUICtrlListView_GetItemText($hLV_Handle, $iRow) ; Clicked device (IP address) ; ConsoleWrite('Debug: --> ' & $sClickedItemText & @CRLF) If $sClickedItemText Then ShellExecute('\\' & $sClickedItemText & '\c$') EndIf ; ------------------------------------------------------ ; WEnd EndFunc ;==>_IP_Scanner Func _button1() ; Button 1 clicked Exit EndFunc ;==>_button1 Func _refresh($Params) ; this receive ping results and displays them in the ListView _GUICtrlListView_SetItemImage($listview, $Params[5], 0) ; set colour to Yellow Sleep(50) ; a little wait If $Params[4] = -1 Then ; Device not responding to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 1) ; set colour to RED _GUICtrlListView_EnsureVisible($listview, $Params[5]) ; Position view to this item Else ; Device responds to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 2) ; set colour to GREEN EndIf EndFunc ;==>_refresh ; https://www.autoitscript.com/forum/topic/155607-how-to-detect-which-listview-was-clicked/ Func _WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return Switch DllStructGetData($tStruct, 1) Case $hLV_Handle If BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) = $NM_DBLCLK Then $iRow = DllStructGetData($tStruct, 4) ; $iCol = DllStructGetData($tStruct, 5) ; Set flags $bClick = True EndIf Case Else Return EndSwitch EndFunc ;==>_WM_NOTIFY_Handler -
Recursive _ArrayDisplay and _DebugArrayDisplay
Gianni replied to Nine's topic in AutoIt Example Scripts
... if you prefer to view the contents of nested arrays within the same window rather than opening different windows for each subarray you can also try this other array viewer: https://www.autoitscript.com/forum/topic/182856-array-viewer -
Exit do not Exit the script
Gianni replied to Lorenzopier's topic in AutoIt General Help and Support
(??) should only return that message to you once. however the "Run" command requires the complete path of the program to be executed. You can try with "ShellExecute" instead of "Run" -
Hi @jguinch regardless of nested arrays, what I mean is that the script you posted above doesn't seem to work as it is if we want to implement that "paradigm", then this script seems to work. (by the way, this also works with nested arrays) (p.s. I hope there are no bugs here... 😀) Further interesting reading about this topic: https://codegolf.stackexchange.com/questions/79609/index-of-a-multidimensional-array https://codegolf.stackexchange.com/questions/37905/mixed-base-conversion ...As mentioned in a comment in the first of above links: "Indexing a multidimensional array is essentially mixed base conversion" p.s. ... I forgot to give credit. The mathematics behind the script is by @Nine from this topic: https://www.autoitscript.com/forum/topic/206284-mixed-base-conversion-coding-challenge/ _Example() Func _Example() Local $aExampleArray[2][3][4] = [[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0]]] Local $aExampleArray1[2][3][4] = [[["Hello", "", "", ""], ["", "", "", ""], ["", "", "", ""]], [["", "", "", ""], ["", "", "", ""], ["", "", "", ""]]] $aExampleArray[1][2][3] = $aExampleArray1 ; <-- here I inject a nested array MsgBox(0, "Example", "Is Array empty? -> " & _ArrayIsEmpty($aExampleArray)) EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayIsEmpty ; Description ...: Scans an entire array to check if it is "empty" ; Syntax ........: _ArrayIsEmpty(Byref $aInput) ; Parameters ....: $aInput - [in] an array ; ; Return values .: Success - True or False (depending on whether empty or not empty) ; ; - If passed argument is not an array ; @error is set to 1 and returns the Null value ; ; Author ........: Gianni ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ArrayIsEmpty(ByRef $aInput) If Not IsArray($aInput) Then Return SetError(1, 0, Null) Local $iSubscripts = UBound($aInput, 0), $aSubscripts[$iSubscripts], $sDimensions, $iSubscriptElements Local $iTotElements = 1, $sLeadingZero, $vContent, $bIsEmpty, $iDigit = -1 For $i = 0 To $iSubscripts - 1 $aSubscripts[$i] = UBound($aInput, $i + 1) $iTotElements *= $aSubscripts[$i] $sLeadingZero &= '[0]' Next For $iIndex = 0 To $iTotElements - 1 $iSubscriptElements = $iIndex $sDimensions = $iSubscriptElements ? "" : "[0]" While $iSubscriptElements ; Calculate the value of each subscript $iDigit += 1 $multiplier = $aSubscripts[$iSubscripts - Mod($iDigit, $iSubscripts) - 1] $sDimensions = "[" & Mod($iSubscriptElements, $multiplier) & "]" & $sDimensions $iSubscriptElements = Floor($iSubscriptElements / $multiplier) WEnd $iDigit = -1 $sDimensions = StringMid($sLeadingZero & $sDimensions, StringInStr($sLeadingZero & $sDimensions, '[', 0, -$iSubscripts)) $vContent = Execute("$aInput" & $sDimensions) ; ConsoleWrite("Debug: " & $sDimensions & @TAB & $vContent & @TAB & VarGetType($vContent) & @CRLF) $bIsEmpty = IsArray($vContent) ? _ArrayIsEmpty($vContent) : Not $vContent If Not $bIsEmpty Then Return False ; Is not empty Next Return True ; Is empty EndFunc ;==>_ArrayIsEmpty
-
Hi @jguinch Looks like the list needs some fixing. Also it wasn't designed to accept nested arrays, right?
-
Hi @Nine Thanks for simplifying the code. My "reduction" was just a quick adaptation of more complicated code intended to simulate nested For-Next loops with the ability to set the initial value of each loop, different step values both positive and negative for each nesting... just like the real For -next loops. (for those interested and needing to use it, the complete code for the For-Next simulator can be found here: https://www.autoitscript.com/forum/topic/180468-traversing-array/?do=findComment&comment=1296451 ) The adaptation used here, as well as your optimization, only allows simpler loops but which for this use case are optimal.
-
Hi @genius257 Just a small oversight: I tried to "build" example.au3 from example.au3p using build.au3 the output file produced contains this little "flaw": If $pObj=0 Then Return $__AOI_E_POINTER "C:\Temp\au3class-master\Example\Example.au3"(30,40) : warning: $__AOI_E_POINTER: possibly used before declaration. If $pObj=0 Then Return $__AOI_E_POINTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Temp\au3class-master\Example\Example.au3"(30,40) : error: $__AOI_E_POINTER: undeclared global variable. If $pObj=0 Then Return $__AOI_E_POINTER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ apart from this the created "object" works correctly.
-
although I think BrowserControl ActiveX is still an option for creating simple interactive interfaces embedded in AutoIt GUI, perhaps the most promising option is to use WebView2. The basic system created by @LarsJ, although still in a "work in progress" state, it can already be used to create something at least functional. It would be interesting to continue developing it to make it more complete and simple to use...
-
In this topic from some time ago (https://www.autoitscript.com/forum/topic/180468-traversing-array/), we were basically discussing how to traverse all the elements of a generic array whose dimensions are unknown. Well in the last post of that thread I posted a way to achieve that. Using that function can save "a few" bytes and shorten the function considerably. You can pass multidimensional arrays and even arrays that contain nested arrays without any problems. I coded the logic whether to consider an element empty or not empty in the function itself on line 30 of the listing rather than passing it via parameter so as to be able to better customize the criterion. Func IsArrayEmpty(ByRef $aMyArray) If Not IsArray($aMyArray) Then Return SetError(1, 0, -1) Local $iDimensions = UBound($aMyArray, 0) Local $sArraySubscript = "$aMyArray" For $i = 0 To $iDimensions - 1 $sArraySubscript &= '[$aLoops[' & $i & '][2]]' Next Local $aLoops[$iDimensions][3] For $i = 0 To $iDimensions - 1 $aLoops[$i][0] = 0 $aLoops[$i][1] = UBound($aMyArray, $i + 1) - 1 $aLoops[$i][2] = $aLoops[$i][0] Next Local $x, $vContent Do $vContent = Execute($sArraySubscript) If IsArray($vContent) Then $IsEmpty = IsArrayEmpty($vContent) ; <-- recursive call for nested arrays Else ; check out your "voidness" logic here ; ------------------------------------ $IsEmpty = ($vContent = '') Or ($vContent = False) Or ($vContent = Null) ; ...... up to you decide EndIf If Not $IsEmpty Then Return False ; Is not Empty $x = UBound($aLoops) - 1 $aLoops[$x][2] += 1 While ($aLoops[$x][2] > $aLoops[$x][1]) $aLoops[$x][2] = $aLoops[$x][0] $x -= 1 If $x < 0 Then ExitLoop $aLoops[$x][2] += 1 WEnd Until $x < 0 Return True ; Is Empty EndFunc ;==>IsArrayEmpty