Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/04/2018 in all areas

  1. nice... and don't worry about wasting time since that is the general purpose of this forum for me, called a hobby! Jos
    2 points
  2. Hello Here is my network UDF. Do not yell at me if it already exists ... I hope it will be useful to someone. Please, let me know if you have any problem. All functions that perform modifications required administrator rights Functions list : Internal functions only : Examples : #Include "network.au3" ; List of availables connections/cards #Include <array.au3> ; only for _ArrayDisplay() $infos = _GetNetworkAdapterList() _ArrayDisplay($infos) ; Network card informations for the network connection called "Local Area Network" $infos = _GetNetworkAdapterInfos("Local Area Network") _ArrayDisplay($infos) ; Disable a network connection _DisableNetAdapter("Broadcom NetLink (TM) Gigabit Ethernet") ; OR _DisableNetAdapter("Local Area Network") ; Enable a network connection _EnableNetAdapter("Local Area Network") ; OR _EnableNetAdapter("Broadcom NetLink (TM) Gigabit Ethernet") ; Enable DHCP (for IP Address) _EnableDHCP("Broadcom NetLink (TM) Gigabit Ethernet") ; OR _EnableDHCP("Local Area Network") ; Configure a static IP adress _EnableStatic("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.10.11", "255.255.255.0") ; OR _EnableStatic("Local Area Network", "192.168.10.11", "255.255.255.0") ; Configure the default gateway _SetGateways("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.10.1") ; OR _SetGateways("Local Area Network", "192.168.10.1") ; Configure DNS servers Local $DNS_SERVERS[4] = [ "192.168.100.1", "192.168.100.2", "192.168.100.3", "192.168.100.4" ] _SetDNSServerSearchOrder("Local Area Network", $DNS_SERVERS) ; OR _SetDNSServerSearchOrder("Broadcom NetLink (TM) Gigabit Ethernet", $DNS_SERVERS) ; Configure the DNS domain name _SetDNSDomain ("Local Area Network", "mondomain.loc") ; OR _SetDNSDomain ("Broadcom NetLink (TM) Gigabit Ethernet", "mondomain.loc") ; Configure the DNS suffixes for all connections : Local $DNS_SUFFIXES[2] = [ "mondomain.loc", "mydomain.priv" ] _SetDNSSuffixSearchOrder($DNS_SUFFIXES) ; Clear the DNS cache (like ipconfig /flushdns) _FlushDNS() ; Remove an entry from the DNS cache _FlushDNSEntry("www.autoitscript.com") ; Configure the WINS servers (very old, now ...) _SetWINSServer("Local Area Network", "192.168.100.251", "192.168.100.252") ; OR _SetWINSServer("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.100.251", "192.168.100.252") ; Enable the two options : ; - Register this connection's address in DNS ( first parameter) ; - Use this connection's DNS suffix in DNS registration (second parameter) _SetDynamicDNSRegistration("Local Area Network", True, True) ; Release the DHCP lease _ReleaseDHCPLease() ; Renew the DHCP lease _RenewDHCPLease() ; Sets the Private category to the network connection called "LAN" _SetCategory("LAN", 1) Download link : Network.au3
    1 point
  3. Heron

    Another debugger for AutoIt

    DEMO VIDEO DBUG demo Update 4, files are changed! 28-jan-2010 - new buttons for debugging and managing the expressions list (add, delete, save, restore) - button images - pause button - mouse over variable names in the source code displays the current variable value as tooltip! Features - Debug the complete script or just parts of it - Display run status (linenumber of currently executed function) - GUI default always-on-top in the upper right corner for comfortable debugging - WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers - Display scope, type and value of variables, expressions, macro's and constants (global AND function local) - Execute commands in an immediate window. Can be expressions, functions and assignments - Detailed display of array, struct and object variables - Dynamic display of variable value in the source code (under cursor) Useage 1) #include <dbug.au3> as first line of the script to debug (after placing dbug.au3 in the include folder of course) 2) copy the images in a folder IMAGES on the same level as the Include folder 3) run the script! That's all. Take special care when debugging message handlers, when they don't return fast enough, strange things may happen. To prevent this, you may add a line ;STOP DBUG before the part you want to exclude from debugging until the line ;START DBUG (or the end of the script). Update 3, files are changed! Extended to debug complete scripts, not just lines. Update2 Although the GUI looks the same, the script is completely rewritten. Changes: - More reliable: debugger doesn't fail on constants and not declared variables. - No limitation to the count of variables that are read. - Determination of variable scope is correct. - Indication of breakpoint line when used with SciTE. - Re-entry of the debugger is prevented and indicated. Update Damn, I found a serious flaw in the script. The basic idea is to Execute() a function with the local variables as arguments. To be changable at debug time they are passed ByRef. This works wonderfull for variables but when constants are passed then the Execute() fails silently. I don't see how I can prevent this, anybody any idea? Original post Hi Gents, when playing with AutoIt I felt the need of an easy way to debug a bit more sophisticated then endless adding msgbox and consolewrites to my scripts. After looking around I start thinking of a way to make local variables visible outside there scope and came up with Dbug.au3. It's far from perfect but I wanted to share with you. Hope to hear your comments and maybe you find it usefull. By now the features are: - display scope, type and value of variables, expressions, macro's and constants (global AND function local) - execute commands in an immediate window. Can be expressions, functions and assignments - detailed display of array, struct and object variables - set a breakpoint expression Limitations are there also: - max 20 variables to display - scope display is not as reliable as it should be - when there is a not declared variable in the debugged function, debugging fails without an errormessage (Opt('MustDeclareVars', 1) helps) - multiple debug windows not allowed (but who does need them anyway?) - and without doubt more not yet discovered bugs! Examples: display: binary($var), @scriptdir, $var_a & $var_b, $arr[1][2], timerinit(), etc commands: $a = $b, ($c >= $d), $struc, $arr[3][4] = 'testDBUG', StringRegExp('TestDBUG', 'D(.*)', 2), etc, etc Usage: - Include the debug script dbug.au3 in the script you want to debug. - Write Execute(_debug()) on every line you want to inspect. - That's all! To play right away I supplied a little test script too (TestDBUG.au3) Files: dbug.au3 - debug script (Update 3 downloads: 94) IMAGES - Folder with fancy button images TestDBUG.au3 - declaration of some variables and calls to debugger I really like to know what you think of it and if you can use it. I spent far more time on it then planned So feedback is appreciated! IMAGES.ZIP Dbug.au3 TestDBUG.au3
    1 point
  4. There was a thread in general support forum the other day about possibility of compiled executable to verify binary integrity of itself when run. I can't find the topic now to link it, but meh never mind. Logical solution is to calculate checksum of the exe and save it somewhere. Later when the executable is run the checksum is calculated again and compared to the saved value. If they match, all is ok, and if they don't the exe was altered and verification fails. The obvious problem is how and where to store the hash value. Alternate data stream seems the simplest solution. That way the hash is bound to the exe only and the risks of unwanted manipulations are relatively low. The problem could be if the exe is saved and run from non-NTFS file systems. Another problem is that any read/write action on exe file usually ends up with ADS being deleted. The other solution is registry writing, but that bounds exe and hash to the system. For another system (or even user) the checking wouldn't be valid. Third solution is using some sort of ini file. But that means ini has to go everywhere exe goes, otherwise again the check wouldn't make sense. And it would be too simple for someone to manipulate data, to the level the check wouldn't make sense. So, this is kind of fourth option. CheckSumVerify2.a3x script below is include file that will calculate the hash of the executable on the first run, save it directly inside that executable using special technique and recheck the hash on every new run. If the new hash wouldn't match the saved one, the script will show message box saying that and further execution will be aborted. CheckSumVerify2.a3x Just to say that I haven't done any complicated tests to see if it would work in outer space, or even on all supported systems. However my guess is it should work. Don't UPX the compiled executables, because I'm calculating checksum of the image on disk and not the one in memory. Here's small example of usage: #include "CheckSumVerify2.a3x" If @Compiled Then MsgBox(64 + 262144, "Aha!", "This is an example exe that does nothing except showing this message." & @CRLF & @CRLF & _ "But if you change the binary of me I will show error message and won't allow further execution." & @CRLF & _ $cmdlineraw) Else MsgBox(64 + 262144, "Hey", "This is an example script that does nothing except showing this message." & @CRLF & @CRLF & _ "But if you compile me I will check binary integrity of the compiled executable every time its run.") EndIf If something wouldn't work, or if you have any questions - simply post here. I'll do my best to answer.
    1 point
  5. I updated the post you might want to recheck it Sorry I realized when I was writing a follow up post that it wasn't right
    1 point
  6. Instead use inetget() Local Const $INET_DOWNLOADBACKGROUND = 1 $text = "google" $url = ("https://www.google.com/search?q="&$text) GetPage($url) Func GetPage($sUrl) Local $WdataAvail = Inetget($sUrl, @ScriptDir & "\pagetext.txt", 1, $INET_DOWNLOADBACKGROUND) If InetGetInfo ($WdataAvail,2) <> True Then for $i = 1 to 30 ;continue for 30 seconds Sleep(1000) If InetGetInfo ($WdataAvail,2) = True Then ExitLoop EndIf Next If InetGetInfo ($WdataAvail,3) <> True Then ;Check for success InetClose($WdataAvail) Msgbox(0,"Error", "Failed") Exit EndIf EndIf InetClose($WdataAvail) EndFunc
    1 point
  7. OP said he wanted to validate the URL at the same time so how about we start getting crazy $url = "https://autoit.com/test1/test2/test3/test4, http://autoet.com/test5/test6/, http://blank.com, http://blank.com/Nope/ ftp://autovt.com/test7/test8/ http://autoet.com/test9/test10/ " $aReg = StringRegExp($url, '(?i)(?x) (?(DEFINE) (?<scheme>..?tps?://)(?<host>\w+\.\w{3}/?)(?<path>[^/\s,]+/))(?&scheme)(?&host)(?&path)(?&path)', 3) For $i = 0 to UBound($aReg) - 1 ConsoleWrite($aReg[$i] & @CRLF) Next https://autoit.com/test1/test2/ http://autoet.com/test5/test6/ ftp://autovt.com/test7/test8/ http://autoet.com/test9/test10/
    1 point
  8. Also, each command you send must end with @LF or @CRLF
    1 point
  9. Jury

    regex url next slash mark?

    $url = "https://autoit.com/test1/test2/" $Reg = StringRegExpReplace($url, '(https://.*?/\w+).*?$', '$1') ConsoleWrite($Reg & @CRLF)
    1 point
  10. @trancexx Would be possible to have a version that if we set a variable containing a timeout value of the msgbox so I can automize the first call without user interaction as Global $CheckSumVerifyTimeout = 1 #include "CheckSumVerify.a3x" If Global not defined same as today no timeout waiting user interction Thanks for this awesome include
    1 point
  11. jchd

    compare strings

    You can use my Typos() fuzzy comparison function: Typos.au3 It computes the edit distance between two strings, that is the number of omissions, insertions, changes or swap of letters necessary to transform one string into the other. If you compare several strings in succession and keep one having the smallest errors (typos) you'll be home. Optionally, you can use two distinct wildcards in the second string: _ and % (the same characters than in SQL LIKE.) _ is a single character joker, much like ? in Windows filename patterns % may represent one or more characters, like Windows * (but % may only appear at the end of the second parameter) Try it and post again if you have problems using it.
    1 point
×
×
  • Create New...