-
Posts
7,103 -
Joined
-
Days Won
88
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by TheDcoder
-
Is it possible to get DOM object without browser?
TheDcoder replied to Vitaliy4us's topic in AutoIt General Help and Support
In that case, you can achieve the same by using IE, it will give a valid object in 99% of the Windows installations There are many tools which allow for this, including a certain AutoIt UDF which controls Microsoft's "Chakra Core" JS engine: By the way, now I think about it, I guess you can use this UDF if Chakra Core comes with the required interfaces to parse an HTML document into a DOM. -
Is it possible to get DOM object without browser?
TheDcoder replied to Vitaliy4us's topic in AutoIt General Help and Support
I see, IHTMLDocument does look promising, but I am not familiar with it and I do not know if it is better than using the usual IE functions. In any case, it is still part of IE according to microsoft's documentation. By the way, the code resembles C more than C++ -
Is it possible to get DOM object without browser?
TheDcoder replied to Vitaliy4us's topic in AutoIt General Help and Support
Well, it is theoretically possible to simulate the DOM Interface with your own implementation which does not depend on a browser. No one as done that yet as far as I know. WinHTTP itself depends on IE I think, and it is only used for sending and recieving HTTP requests, not for processing HTML and providing a DOM Interface -
Is it possible to get DOM object without browser?
TheDcoder replied to Vitaliy4us's topic in AutoIt General Help and Support
Not to mention that Node.js is basically a wrapper around Chrome's V8 JavaScript engine IE is installed in 99% of the Windows installations, so it is a bit universal in that regard, if that is what you meant by being "free of the browser type". No, you are mistaken, the browser itself is the thing which makes the traditional JavaScript DOM interface tick... so to put in it more bluntly, you want the monster's abilities without its negative side effects. -
Is it possible to get DOM object without browser?
TheDcoder replied to Vitaliy4us's topic in AutoIt General Help and Support
The JavaScript interface is part of the browser, and all of the required processing is done by the browser, so it doesn't make much sense how all that can function without the DOM object being bound to the browser. Anyway, I assume the real question is, why do you not want to use the browser? -
Is it possible to get DOM object without browser?
TheDcoder replied to Vitaliy4us's topic in AutoIt General Help and Support
It depends on what you mean by "DOM", you can easily use the InetRead function to just get the HTML and then use something like an XML parser to get the "DOM". -
Sorry, I do not program in C++ so I don't know the specifics of how objects/classes work there. Someone more capable will answer your question
-
Best of luck with your learning @markyrocks, it is a fun journey assuming that you enjoy what you are doing.
-
Depends on the compiler, most popular ones compile directly to machine code targeting a specific instruction set (x86 is the most common), there is even a C/C++ compiler which compiles to JavaScript which you can run in your browser Very. A compiled AutoIt script is just AutoIt3.exe merged with a copy of your script, there is no actual "compilation" happening besides the pre-processing done by AutoIt3Wrapper and Aut2Exe The latter is correct. C++ started as an OOP expansion for C, but it spiraled into its own language as the features were being developed. The current version is written in C++, and it is not a layer over C++. It is just written in it, the actual stuff that runs is machine code which is directly capable of being executed by the processor. AutoIt doesn't have an actual compiler like I have mentioned, only the script is embedded and it is interpreted everytime the executable is ran. And the speed between uncompiled and compiled scripts doesn't very much because AutoIt does not optimize anything in your script besides the usual when compiling First guess is correct, the interpreter is hardcoded, so it is essentially a layer your own script in the .exe
-
Indeed, as so does learning any lower level language. For the full effect, try C, it will make you appriciate all the things AutoIt can do with ease a lot more C++ is a high-level language when compared to C, so it is a bit like going from AutoIt to C++! Make no mistake, C is great, I for one prefer it over C++ as C has less abstractions while still having a good amount of features to make programming productive. I imagine once you try assembly/machine code, you will appriciate C the same way as you do for AutoIt when working with C++
-
Indeed, there is good reason why RegEx is faster, it has less overhead processing strings as it runs in pure machine code, so we cannot compare both methods really. If everything is written in a low-level language, my method would be fastest... a lot faster than RegEx
-
Good to see that my Array approach ins't falling behind too much with a consistent 2nd position Also surprised to see that RegEx is slower than _ArrayAdd
-
TheSaint has already gone that route, but he prefers to stick to simpler INI functions as SQLite is complex and does not bode well with his mindset of simple programming as he explained here :
-
Those results are pretty wacky, AutoIt is performing some memory tradeoff to make string concatenation more efficient, which is good for people who want simple and fast code and don't mind some extra memory use. Anyway, the only remotely expensive operation in the timed parts of my code is the ReDim operation, which is only done once when the $iSectionCount guess is wrong (and it is right most of the time assuming not many INI files have the [ character as a value in one of their keys). The only other modification is: $SectionNames[0] += 1 $SectionNames[$SectionNames[0]] = $INIsection Which is supposed to be an almost instant operation, certainly when compared to string concatenation So there are other factors at play, and performance is not always reliable, especially when attempting to measure it according to my personal experience. In any case, my code doesn't depend on assumptions and trade-offs being made by the interperter (AutoIt) and it is pretty solid.
-
Another point, someone might think that my StringCount function is not correct for detecting the number of sections in the file... and they would be right, it is just an approxmation, not an absolute value of the number of sections in the INI file. As everyone knows how high my coding standards are, I have obviously accounted for the possibility of an over-estimation, so an INI file with these contents would still work: [Foobar1] error=[ [Foobar2] [Foobar3]
-
Whoever said that is silly, any coder with half a brain would know that resizing an array is heaps slower than concatenating a string Anyway, I improved your function by using an Array, but in a different and more efficient way: #include <Array.au3> #include <StringConstants.au3> Global $i, $INIfile, $INIlines, $INIread, $INIsection, $linetxt, $SectionNames Example() Func Example() Local $aSections = _ReadIniSectionNames("Test.ini") _ArrayDisplay($aSections) EndFunc Func _ReadIniSectionNames($INIfile) $INIread = FileRead($INIfile) Local $iSectionCount = StringCount($INIread, '[') Local $aSections[$iSectionCount + 1] $aSections[0] = 0 $INIlines = StringSplit($INIread, @LF, 1) If @error Then Return SetError(1, 0, -1) Else For $i = 1 To $INIlines[0] $linetxt = $INIlines[$i] If StringLeft($linetxt, 1) = "[" Then $INIsection = StringTrimLeft($linetxt, 1) $INIsection = StringStripCR($INIsection) $INIsection = StringTrimRight($INIsection, 1) If $INIsection <> "" Then $aSections[0] += 1 $aSections[$aSections[0]] = $INIsection EndIf EndIf Next If $aSections[0] = 0 Then Return SetError(2, 0, -2) Else If $aSections[0] < $iSectionCount Then ReDim $aSections[$aSections[0] + 1] Return $aSections EndIf EndIf EndFunc ;=> _ReadIniSectionNames Func StringCount($sMasterString, $sString) Local $iPos = 0 Local $iCount = 0 While True $iPos = StringInStr($sMasterString, $sString, $STR_NOCASESENSEBASIC, 1, $iPos + 1) If @error Or $iPos = 0 Then ExitLoop $iCount += 1 WEnd Return $iCount EndFunc
-
You should check out my Process UDF which is exactly what it is supposed to do that and it even has an example of a GUI which shows you the output of a command:
-
Okay, so not an issue with something in the loop. The next natural step is to investigate what WinAPI functions are being called and which one of them is returning an error. Unfortuately I cannot do that step as my Windows box is down and it takes a long time to start it. Hopefully someone else more qualified will check the functions. Oh! And don't forget to check the authors of that function in Clipboard.au3 and tag them here if they are still active in the forum
-
Sounds like a bug in the _ClipBoard_GetPriorityFormat function, did you check how many times the loop iterates before the error occurs? By the way, you might want to change the title of the topic to something like "_ClipBoard_GetPriorityFormat bug/crash" instead of the whole error line which is hard to read
-
RegEx builder algorithm for MAC address list
TheDcoder replied to spudw2k's topic in AutoIt General Help and Support
@spudw2k Okay, good luck -
RegEx builder algorithm for MAC address list
TheDcoder replied to spudw2k's topic in AutoIt General Help and Support
If you are planning to write an algorithm for generating regular expressions for matching unique strings in a given set, you can just concatenate all strings with the | meta character which acts as a logical or in your regex. -
Yes, for the sake of completeness, I intend to use every available keyword in the reference script This belief seems to have stemmed from some kind of misconception and then spread throughout the scripts shared as examples in this forum. If you read the help file entry for Dim, you will get to know that it is not really different from other declaration keywords. The only special thing about it is that the scope of the variable defined using Dim is dependent on the availability of a variable with the same name in the Global scope. If a variable already exists in the global scope in the same name, nothing is done and the variable will refer to the global variable, otherwise it is created as a normal local variable which is only valid inside the function. It is generally not a good idea to depend on hacks such as this... and this will certainly throw in a cog for me when developing the actual interpreter as the scope cannot be determined during compile time. Also do not confuse it with the similar ReDim keyword, which is used to resize arrays Are you sure that this is true? I do not see anything special about Dim in this case, you can use Local to redeclare the variable in this case and it would work just as fine I am guessing. Correct me if I am wrong. Indeed, it is just a script which can be used as a good reference to display all possible syntax variations in AutoIt. It will also be useful to test my parser when I get around to writing it.