Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/04/2017 in all areas

  1. On the tests I did I saw that activating the "WOL" parameter in the bios, and running the script from a client of the same LAN is enough to turn on the target client. Here is a little modification on the original script, so that it's enought to pass only the MAC address of the target client to be turned on. I've inserted 2 functions: one to get the SubnetMask and another to get the broadcast address so that it works on any LAN without the need to calculate those 2 lan parameters. If you need to turn on a client of a remote LAN instead, then you can use the PaExec program ( a better and free version of psexec) to run this wol executable on a client of that remote LAN (this is the reason to compile this script as command line exe) ; Wake On Lan ; http://www.autoitscript.com/forum/topic/29772-copyright-free-wake-on-lan-script/page__hl__%20lan%20%20scanner ; This script must be compiled in "command line mode" ; It must be run with just one parameter, that is the MAC address of the client on this LAN to be turned On. ; Since you can turn On only clients of the same LAN, this script can automatically retrieve the other 2 required ; parameters: the SubnetMask and the BroadcastAddress from the client where it runs. ; (Same LAN = same SubnetMask and same Broadcast address for all the LAN and all clients belonging to it) ; to run this exe on a remote client of another LAN you can use the PaExec tool (a better and free version of PsExec) ; get PaExec from here: -> https://www.poweradmin.com/paexec/ ; #AutoIt3Wrapper_Change2CUI=y If $CmdLine[0] Then Local $MACAddress = $CmdLine[1] ; get mac address from the first (and the only) command line parameter $MACAddress = StringReplace(StringReplace($MACAddress, ":", ""), "-", "") ; remove ":" or "-" if any Else ConsoleWriteError("Error: missing MAC address") Exit EndIf Local $IPAddress = @IPAddress1 Local $sSubNet = _GetLocalMask() Local $sBroadcast = _GetLocalBroadcast($IPAddress, $sSubNet) UDPStartup() $connexion = UDPOpen($sBroadcast, 7) $res = UDPSend($connexion, GenerateMagicPacket($MACAddress)) ; MsgBox(0, "", $res) ConsoleWrite("The magic packet was fired." & @CRLF) UDPCloseSocket($connexion) UDPShutdown() ; =================================================================== ; Functions ; =================================================================== ; This function convert a MAC Address Byte (e.g. "1f") to a char Func HexToChar($strHex) Return Chr(Dec($strHex)) EndFunc ;==>HexToChar ; This function generate the "Magic Packet" Func GenerateMagicPacket($strMACAddress) $MagicPacket = "" $MACData = "" For $p = 1 To 11 Step 2 $MACData = $MACData & HexToChar(StringMid($strMACAddress, $p, 2)) Next For $p = 1 To 6 $MagicPacket = HexToChar("ff") & $MagicPacket Next For $p = 1 To 16 $MagicPacket = $MagicPacket & $MACData Next Return $MagicPacket EndFunc ;==>GenerateMagicPacket ; This function retrieve the Subnet Mask of this LAN Func _GetLocalMask() Local $IP = @IPAddress1, $Text = "", $Subnet = "" $PID = Run("ipconfig", "", @SW_HIDE, 2) Do Sleep(10) $Text &= StdoutRead($PID) Until @error Local $aText = StringSplit($Text, @CRLF, 1) For $i = 1 To $aText[0] If StringInStr($aText[$i], $IP) Then $Subnet = StringMid($aText[$i + 1], StringInStr($aText[$i + 1], ":") + 2) ExitLoop EndIf Next Return $Subnet EndFunc ;==>_GetLocalMask ; This function retrieve the Broadcast address of this LAN Func _GetLocalBroadcast($sIP, $sMask) Local $aIPAddress = StringSplit($sIP, '.'), $aSubnetMask = StringSplit($sMask, '.') $sIP = '' For $i = 1 To $aIPAddress[0] $aIPAddress[$i] = BitOR($aIPAddress[$i], BitNOT($aSubnetMask[$i] - 256)) $sIP &= $aIPAddress[$i] & '.' Next Return StringTrimRight($sIP, 1) EndFunc ;==>_GetLocalBroadcast
    1 point
  2. Jos

    HELP ABOUT ARRAY

    Just ignore it and move on as I am sure you won't be changing them, so just concentrate on your goal and forget about making the discussion personal. Jos
    1 point
  3. I bet it's the problem too. The DriveSpaceFree() function seems to be working for what I need to do, I can now see disk space decreasing as opposed to The DirGetSize() function that would not work. Thanks a lot for your help
    1 point
  4. Assuming x64 System in which case use HKLM64 in place of HKEY_LOCAL_MACHINE
    1 point
  5. @eqjtlm these controls are from VB6 previous century build. Only if you see a small area / cell highlighting with simplespy you could try with a combination of sendkeys but otherwise its hard to tell how to deal with this exactly @TheDcoder Am I doing it right? is a weird question if its not working title:= with nothing behind it then you can leave it away. From all properties you must leave away the UIA_ prefix. see uiawrappers $UIA_propertiesSupportedArray ["HelpText", $UIA_HelpTextPropertyId], _ ["IsOffscreen", $UIA_IsOffscreenPropertyId], _
    1 point
  6. Does this work? $hWindow = WinGetHandle("Select AutoCAD") $hControl = ControlGetHandle($hWindow, "", "[CLASS:ListBox; INSTANCE:1]") ControlCommand($hWindow, "", $hControl, "SelectString", "Text of the item you want selected") ; Change this
    1 point
  7. InnI

    Hex to string Unicode

    BinaryToString("0x4CC6AFC6A04E472056C4824E205448C38C4E", 4)
    1 point
  8. Is that what you want? Local $in = [ _ "This is Line1.This is Line2", _ ; -> Match and replace "This is Line1. This is Line2", _ ; -> Non match "S.O.S." _ ; -> Non match ] For $s In $in ConsoleWrite(">" & StringRegExpReplace($s, "\.(?=[A-Z][a-z])", "." & @CRLF) & "<" & @LF) Next
    1 point
  9. UEZ

    Loop Optimal Performance

    Benchmarking "naked" loops is not realistic imho because usually the performance killers are inside the loops. That means whether you use e.g. While/Wend or For/Next will make no real "feelable" difference. But anyhow, "a nice to know" for the community.
    1 point
  10. 232showtime

    SystemParametersInfo's

    whats inside the $SPIF_SENDCHANGE ????
    1 point
  11. whats in the startup and apphistory of your taskmanager (any exes you don't recognize)?
    1 point
  12. UEZ

    Hex to string Unicode

    Try this: #include <WinAPI.au3> Global $bin = Binary("0x4CC6AFC6A04E472056C4824E205448C38C4E") Global $tString = DllStructCreate("ubyte txt[" & BinaryLen($bin) & "]") $tString.txt = $bin ConsoleWrite(_WinAPI_MultiByteToWideChar($tString, 65001, Default, True) & @CRLF)
    1 point
  13. Gianni

    Wake on Lan COM object

    ..... If you prefer not to have to register third part's dll on clients around, you can use this little script instead that it works very well without any registration.
    1 point
  14. Maybe this. HotKeySet("{ESC}", "_Terminate") ; Press Esc to exit. While Sleep(Random(100, 1000, 10)) ; Random time intervals Send("{" & (Random(0, 1, 1) ? "UP " : "DOWN ") & Random(1, 70, 1) & "}") ; Random direction up or down, and, random number of times of ups or downs sent. WEnd Func _Terminate() Exit EndFunc ;==>_Terminate
    1 point
  15. How about this? $key = Random(1,2,1) If $key = 1 Then $count = Random(1, 70, 1) Send("{DOWN " & $count & "}") Return ElseIf $key = 2 Then $count = Random(1, 70, 1) Send("{UP " & $count & "}") Return EndIf
    1 point
  16. Welcome to the forums. First, the help document for the Send function has a great description on how to send a key $n amount of times. Second, you have the wrong syntax for the call to Random. Third, the call to random assigns to the left of the assignment operator (see the help file for how to use Random) Finally, Why? Why send up/down randomly. If you're trying to select some controls there are much easier/better ways.
    1 point
  17. doestergaard

    _PathSplit help

    @Melba23 I read the basics about _FileListToArray from the help file and created this: #include <GUIComboBox.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <Array.au3> ; Create combobox $SelectOS = GUICtrlCreateCombobox ( "", 106, 167, 412, 200, $CBS_DROPDOWNLIST ) ; Get wim files from folder $WimPath = "Z:\images" $WimFiles = _FileListToArray ( $WimPath, "*.wim" ) _ArraySort ( $WimFiles, 0, 1 ) For $i = 1 To UBound ( $WimFiles ) -1 $ListOS = StringRegExpReplace ( $WimFiles[$i], "^.*\\|\..*$", "" ) GUICtrlSetData ( $SelectOS, $ListOS ) Next _GUICtrlComboBox_SetCurSel ( $SelectOS, 0 ) If $WimFiles = "" Then MsgBox ( $MB_ICONWARNING, "OS Deployment", "WARNING! No operating systems found!" ) EndIf It worked, thanks!
    1 point
  18. Ruud0209

    ...exe builder

    The problem seems to be in the #include statement. since it needs to include the "includes" it needs to know where they are and it assumes they are in the scriptdir but they are not so either you copy them there along with the exe's and bins you install or you add a path to the includes in your include statement. (to see what I mean copy Guiconstants.au3 from the \Program Files\AutoIt3\Include dir to your project dir and you will see the message changes to the next include it needs). You can also put the includes you need in a include subdir in your project dir. Also , in Scite do a F1 on #Include for more info.. regards, Ruud
    1 point
×
×
  • Create New...