Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/24/2015 in all areas

  1. Hopefully this will get useful for others as it did for me. My collegue found out which registry entry is responsible for Maximized option in IE and so I've scripted it. To change the Internet Explorer setting to always open maximized you have to first 18 chars from the value as described below: -> HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window_Placement", "REG_BINARY" When IE window is not maximized the key value is similar to this: 2C0000000000000001000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF160000001D0000003603000075020000 When IE window is maximized the key value is similar to this: 2C0000000200000003000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF160000001D0000003603000075020000 The only thing that changes is first 18 chars. Simply replacing them works as descrbed. NOTE: the values after FFFFF are changing constantly depending on user settings so it will vary for every computer/user. NOTE on the script. The script returns 1 if failed to change the key and returns 0 if everything is okey. Global $reg_read, $reg_write Global $reg_value = "2C0000000200000003" $reg_read = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window_Placement") If $reg_read <> "" Then $reg_write = RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Window_Placement", "REG_BINARY", $reg_value & StringTrimLeft($reg_read, 18)) If $reg_write = 1 Then Exit(0) EndIf Exit(1) Regards, MadBoy
    1 point
  2. TheSaint

    UpDir for any path

    You should have error checking. You should also use something like StringSplit, to tell how many up folders there are, and also cater for the drive letter. _PathSplit is probably the better way to go too, and determining whether the original path is to a folder or file.
    1 point
  3. Jos

    Aut2Exe compiling error

    Just for the record: I am happily married and very straight. Jos
    1 point
  4. 1 point
  5. sahsanu

    Get Reverse DNS Name

    Hello, Just a quick and dirty example using nslookup command: #include <Constants.au3> Local $hostname="autoitscript.com" ;just a hostname example using autoitscript.com Local $DNSserver="8.8.8.8" ;just an example using Google DNS server (if you want to use default server just remove the ip: Local $DNSserver="" $GETNORMAL=_NormalLookup($hostname,$DNSserver) If @error Then MsgBox(0,"","Error trying to get ip for " & $hostname) Exit Else MsgBox(0,"","Normal Lookup for hostname " & $hostname & " is " & $GETNORMAL) EndIf $GETREVERSE=_ReverseLookup($GETNORMAL,$DNSserver) If @error Then MsgBox(0,"","Error trying to get reverse lookup for " & $hostname) Exit Else MsgBox(0,"","Reverse Lookup for ip " & $GETNORMAL & " is " & $GETREVERSE) EndIf Func _ReverseLookup($fip="127.0.0.1",$fDNSserver="") Local $Consigue=Run(@ComSpec & " /c " & 'nslookup -type=PTR ' & $fip & ' ' & $fDNSserver, "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($Consigue) If @error Then ExitLoop WEnd Local $array=StringRegExp($line,".*name\ =\ (.+)?",3) If @error Then SetError(1) Else Return StringStripWS(StringStripCR($array[0]),8) EndIf EndFunc Func _NormalLookup($fhostname="localhost",$fDNSserver="") Local $Consigue=Run(@ComSpec & " /c " & 'nslookup -type=A ' & $fhostname & ' ' & $fDNSserver, "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($Consigue) If @error Then ExitLoop WEnd Local $array=StringRegExp($line,"(?s)Name:.*Address:\ (.+)",3) If @error Then SetError(1) Else Return StringStripWS(StringStripCR($array[0]),8) EndIf EndFunc Keep in mind what I said, it is quick and really dirty, it will fail if the hostname has more than one ip, etc. so I recommend to take a look to already implemented functions TCPNameToIP and _TCPIpToName (check the examples in AutoIT help). Edit: To add example using TCP functions: #include <Inet.au3> Local $hostname=@ComputerName TCPStartup() $tcpnametoip=TCPNameToIP($hostname) $tcpiptoname=_TCPIpToName($tcpnametoip) MsgBox(64,"Reverse Lookup", "Hostname " & $hostname & " resolves to " & $tcpnametoip & @CRLF & _ "IP " & $tcpnametoip & " reverses to " & $tcpiptoname) Cheers,
    1 point
×
×
  • Create New...