Leaderboard
Popular Content
Showing content with the highest reputation on 11/24/2020 in all areas
-
Generate all binary string possibilities of n bits
JockoDundee and one other reacted to Nine for a topic
Even simpler : Combine("", 4) Func Combine($Str, $nBit) $t = $nBit ? Execute(Combine($Str & 0, $nbit-1) & Combine($Str & 1,$nBit-1)) : ConsoleWrite ($Str & @CRLF) EndFunc2 points -
Increment an integer from 0 to 2โฟ-1 If you actually need the binary expansion in string form: Local $n = 9 Local $s = "" Local $aRes Local $zeroes = _StringRepeat("0", $n - 1) For $i = 0 To 2 ^ $n - 1 $aRes = DllCall("ntdll.dll", "str:cdecl", "_ui64toa", "int64", $i, "str", $s, "int", 2) ConsoleWrite(StringRight($zeroes & $aRes[0], $n) & @LF) Next2 points
-
Sorry about the lack of updates, I have been busy with life (as usual) and wasn't able to properly formulate a plan on how to proceed forward with parsing statements, I decided that it would be better to tackle expression parsing now, but that threw me into a whole new tangent about various different kinds of techniques for parsing expressions... luckily I have made up my mind with what approach I will use in the initial implementation, I am not 100% sure it will work, but it should. In the mean-while I created an "official" thread for the project: This thread was never really meant to be used for actual technical discussion of the implementation, and it has gotten too big and ugly anyway, it is impossible for new users to get a brief glance about the whole thing without reading through all the pages. So everyone please follow the new thread for updates! I should have an update out soon if all goes according to plan2 points
-
EasyCodeIt A cross-platform implementation of AutoIt Introduction: EasyCodeIt is an attempt at implementing a programming language which is backward compatible with a sub-set of AutoIt which would work across multiple platforms with many aspects being agnostic to the platform-specific differences. Currently the primarily targeted platforms are Linux and Windows, more platforms may be supported in the future as per popular demand. For example it should be easy enough to port to Unix-like platforms such as BSD and Mac with the help of maintainers who are familiar with them. The main motivation behind the creation of this project is the lack of a proper easy-to-use scripting language in Linux, while there are numerous scripting languages which natively support it, none of them are as user-friendly and easy to use as AutoIt. (The "Easy" in "EasyCodeIt" reflects this) There was a previous thread in which the project was originally started, but it got too big and the discussion is too cluttered and hard to follow for any new readers, here is the thread for those who are interested in reading it: Progress: Frontend โ Tokenizer ๐ง Parser (work in progress) โ Expressions ๐ทโโ๏ธ Statements (current priority) Backend โฐ Interpreter (scheduled) I am currently working on expression parsing and syntax tree building. -- This section will be updated in the future with new progress. To stay notified ๐ follow this thread to get update notifications (by using the "Follow" button on the top-right corner of this page) and ๐๏ธ watch the GitHub repository to get any new activity on your feed. Code: The code is available on GitHub, please ๐ star the project if you like it and would like to show your support, it motivates me a lot! (Also don't forget to ๐ Like this post ) Chat: I created a room in Matrix (an open-source federated chat system) for EasyCodeIt, you can join it to chat with me and others who are in the room, it might be a good way to get the latest status updates from me You can preview the room without joining, and you don't need to be connected to it 24/7 like IRC. It works a bit like Slack for those who are familiar with it. Forum: I have created a dedicated forum to post more frequent updates, possibly in their own threads to better organize the discussion. Please sign-up and follow the blog section to get updates. By the way, you can also post pretty much anything there, both technical and non-technical stuff, it is intended to be a hangout for techies but not only for them. So casual discussions, funny cat videos etc. are allowed!1 point
-
Generate all binary string possibilities of n bits
jchd reacted to JockoDundee for a topic
True. Please understand I had to post it, even if as purely a defensive measure, as I was not ready to entertain the inevitable smugness of anyone elseโs recursive gloating1 point -
Generate all binary string possibilities of n bits
TheXman reacted to JockoDundee for a topic
Simpler: PrintBits($CmdLine[1],"") Func PrintBits($iBits, $sBits) If Not $iBits Then Return ConsoleWrite($sBits & @CRLF) PrintBits($iBits-1,$sBits & 0) PrintBits($iBits-1,$sBits & 1) EndFunc1 point -
Generate all binary string possibilities of n bits
JockoDundee reacted to TheXman for a topic
Here's one way to do it. Note that this example will only work up to 32 bits because the AutoIt bit operations only work with 32-bit integers. If you need to work with more bits, you will need a different solution. display_bit_combinations(4) Func display_bit_combinations($iNumberOfBits) Local $sBits = "" ConsoleWrite("Number of bits to display: " & $iNumberOfBits & @CRLF) ;Loop thru integers from 0 to 2^bits - 1 For $i = 0 To (2 ^ $iNumberOfBits) - 1 ;Loop thru integer's bits from high-order bit to low-order bit ;to build the bit string in big-endian $sBits = "" For $j = $iNumberOfBits - 1 To 0 Step -1 $sBits &= (BitAND($i, 2 ^ $j) ? "1" : "0") Next ConsoleWrite($sBits & "b = " & $i & @CRLF) Next EndFunc Output: Number of bits to display: 4 0000b = 0 0001b = 1 0010b = 2 0011b = 3 0100b = 4 0101b = 5 0110b = 6 0111b = 7 1000b = 8 1001b = 9 1010b = 10 1011b = 11 1100b = 12 1101b = 13 1110b = 14 1111b = 151 point -
If you want to do this in this way.... #include <C:\MyFolder\FileConstants.au3> that is not properly usage. Try this form instead: #include "C:\MyFolder\FileConstants.au3" https://www.autoitscript.com/autoit3/docs/keywords/include.htm1 point
-
Hi @mLipok, That topic is also very interesting, (maybe even more than this), making Edge "embeddable" in AutoIt, but unfortunately there is not something 'runnable' in AutoIt yet, however I stay tuned to that ... This post on CEF (Chromium Embedded Framework) instead offers something already usable in AutoIt, so I find it interesting to be able to do some practical experiments ...1 point
-
@NassauSky change this line $sElement = _WD_FindElement($mElement, $_WD_LOCATOR_ByXPath, '/..', Default, True) with this $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '..', $mElement, Default)1 point
-
the same question araise in my mind. Edit: How you could miss this1 point
-
@NassauSky You should be able to do it with _WD_FindElement (pass $mElement as the starting element and use ".." as the xpath) or _WD_ExecuteScript.1 point
-
set a pic ontop on a listview ??
AlienStar reacted to pixelsearch for a topic
@AlienStar & Musashi : glad the 2nd way worked for you As you can see in the pic of my precedent post (zoomed below) the green selection of 1st row overlaps just a bit above the pic. To avoid this, may I suggest to retrieve the exact height of the listview header with this kind of line in the script : $iHeaderHeight = _WinAPI_GetWindowHeight($hHeader) Now that we got the exact height in the variable $iHeaderHeight, it's easy to use this variable as the height of the child gui and as the height of the pic, leading us to : #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 620, 140) $listview_st = GUICtrlCreateListView("#|sections", 30, 20, 579, 93) GUICtrlCreateListViewItem("1|100", $listview_st) GUICtrlCreateListViewItem("2|200", $listview_st) $hHeader = _GUICtrlListView_GetHeader($listview_st) $iHeaderHeight = _WinAPI_GetWindowHeight($hHeader) ; ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($listview_st))) ; Melba23's way. ControlDisable($hGUI, "", $hHeader) ; seems ok without HWnd($hHeader) as in line before ? $hGUI_Child = GUICreate("", 579, $iHeaderHeight, 30, 20, $WS_CHILD, -1, $hGUI) $idPic = GUICtrlCreatePic("head_main.jpg", 0, 0, 579, $iHeaderHeight) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Child) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI_Child) GUIDelete($hGUI) No more overlap :1 point -
If the final purpose is to make some kind of custom header, you might also have a look to these master scripts by LarsJ - particularly the "Custom drawn\Icons and bitmaps.au3" part https://www.autoitscript.com/forum/topic/178680-customowner-drawn-multi-line-header-in-listview/?tab=comments#comment-12822791 point
-
!? how could i miss this post so far? I can't believe it ... anyway ... it looks very interesting. If anyone has further usage examples, they are welcome if are posted here. Thanks1 point
-
Please find a small Func and test utiltiy for doing reverse DNS lookups on a network Here is some history behind the FUNC I recently had a requirement at work incorporate a reverse dns lookup scanner into one of my Autoit programs. My first attempt was to use the UDF Function _TCPIpToName(ipaddress). This would work fine if there was a valid reply from the network but would take aprox 4.5 seconds per ip address if the FUNC timed out. This was way to slow as I had hundreds of potential ip addresses to scan. I needed to find a better way. Looking through the forums I found a useful post (http://www.autoitscript.com/forum/index.php?showtopic=63353) by forum member Fox2. This FUNC used the Windows command prompt PING utility and with a little tweaking, I managed to get the timeout to be much shorter than the UDF func above. This prompted me to experiment a bit further and I eventually managed to write a simillar function using the windows command prompt tool NSLOOKUP. The NSLOOKUP tool doesn't need to PING the network devices before resolving the names so it is quicker and produces less network traffic. Also, not all network devices are Pingable so NSLOOKUP should have a better hit rate. Anyway, here is my simple _ReverseDNS Func using NSLOOKUP New Version: Posted 8th August 2012 Added StderrRead command as suggested in Knollo's code (post #6) Func _ReverseDNS($IPAddress) Local $NSLookupCmd,$ResponseText,$X1,$X2 $IPAddress = StringStripWS($IPAddress,3) $NSLookupCmd = Run(@ComSpec & " /c nslookup "& $IPAddress, "", @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD) While 1 StderrRead($NSLookupCmd) If @error Then ExitLoop WEnd $ResponseText = StdoutRead($NSLookupCmd) If @error Then Return $x1 = StringInStr($ResponseText, "Name:") $x2 = StringInStr($ResponseText, "Address",0,-1) If $x1 > 0 and $x2 > 0 Then Return StringStripWS(StringMid($ResponseText, $x1 + 6, $x2 - $x1 - 6),3) Return "Unknown" EndFunc1 point