Leaderboard
Popular Content
Showing content with the highest reputation on 04/14/2012 in all areas
-
Bluetooth Detector/Switching Script
Qwerty212 reacted to stormbreaker for a topic
Hello everybody, this is my first example script weeks after giving my exams. Here is it: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Bluetooth Manager (just something)", 409, 135, 192, 124) $Label1 = GUICtrlCreateLabel("This script will check if your PC is bluetooth enabled.", 8, 8, 368, 17) $Button1 = GUICtrlCreateButton("Check if device present", 112, 48, 171, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Disable Discovery for all Bluetooth Devices on PC", 16, 96, 257, 17) $Button2 = GUICtrlCreateButton("Exit", 312, 96, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $RESULT = DllCall("bthprops.cpl", "Bool", "BluetoothEnableIncomingConnections", "Handle", 0, "Bool", 1) If $RESULT[0] = 1 then msgbox(64, "Message", "Congrats! Your Computer is bluetooth enabled.") else msgbox(16, "", "No device found") EndIf Case $Checkbox1 If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then $RESULT = DllCall("bthprops.cpl", "Bool", "BluetoothEnableDiscovery", "Handle", 0, "Bool", 0) msgbox(64, "", "Discovery Disabled.") Else $RESULT = DllCall("bthprops.cpl", "Bool", "BluetoothEnableDiscovery", "Handle", 0, "Bool", 1) msgbox(64, "", "Discovery Enabled.") EndIf Case $Button2 Exit EndSwitch WEnd It can check if your PC is bluetooth enabled and can switch between bluetooth discovery modes. All functions taken from Microsoft's bthprops.cpl Constructive suggestions are always welcome Enjoy. Note: Bluetooth discoverability can be controlled as long as the script is running. Once terminated, bluetooth state changes back to previously set by user. This is a Microsoft bluetooth function issue. EDIT: This script is only meant for discovering Bluetooth Radios on a PC. That's all.1 point -
Then look into _IEAttach to get the object handle to your already active iexplorer window and use the _IELinkGetCollection. You should make use of the help file in scite, whenever you come across a function, click it and press [F1] to get information about it.1 point
-
This should show you how you might achieve what you want Local $sUrl = "http://www.Domain.com/pageid/" Local $sFind = "HerroThere" Local $sSource = "" Local $iFirstPage = 1 Local $iLastPage = 20 For $i = $iFirstPage To $iLastPage $sSource = _INetGetSource($sUrl & $i) if StringInStr($sSource, $sFind,0) Then FileWriteLine("test.txt","Found " & $sFind & " on page " & $i & " of " & $sUrl) endif Next1 point
-
Easy memory search.
Washingtonhdmf reacted to daslick for a topic
#include <NomadMemory.au3> Dim $hex[16] = [0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F'] $HPROCESS = _MemoryOpen($ProPID) For $a = 0 to 15 step 1 ;checking 0*##8E90 For $b = 0 to 15 Step 1 For $c = 0 to 15 step 1 if _MemoryRead(0x&$hex[$a]&$hex[$b]&$hex[$c]&$hex[9]&$hex[13]&$hex[10]&$hex[0],$HPROCESS) = 503 then _MemoryWrite(0x&$hex[$a]&$hex[$b]&$hex[$c]&$hex[9]&$hex[13]&$hex[10]&$hex[0],$HPROCESS,1000) Next Next Next The code is trying to search all of 0x9###8E90 for 503, where #s are unknown values. Any ideas?1 point -
This will break scripts if someone uses a variable called "$output" in a function called "output", right? Why don't you include the $ in the actual name of the variable, so that $var <> var? This would prevent breaking scripts and in my opinion this it would be a logical choice.1 point
-
What the hell is all this non-sense about? ConsoleWrite("AutoIt version: " & @AutoItVersion & @CRLF) Local Writer = ConsoleWrite Writer("What the hell, this works?" & @CRLF) Writer = MyConsoleWrite Writer("This works, too!?" & @CRLF) Func MyConsoleWrite(sText) ConsoleWrite("MyConsoleWrite(): " & sText) EndFunc Output: AutoIt version: 3.3.9.5 What the hell, this works? MyConsoleWrite(): This works, too!? Tomorrow... maybe...1 point
-
1 point
-
armoros, Something else that I am working on broke my brain so I've been goofing around with this. Here's a more complete way to do this. ; example of using stdout with network commands #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <StaticConstants.au3> Local $Gui010 = GUICreate("Network Properties", 800, 600) Local $Button1 = GUICtrlCreateButton("IPCONFIG",10, 10, 75, 25) Local $Button2 = GUICtrlCreateButton("NETSTAT", 90, 10, 75, 25) Local $clear = GUICtrlCreateButton("Clear Display", 700, 10, 90, 25) GUICtrlSetBkColor($clear,0xff0000) GUICtrlSetFont($clear,8.5,800,default,'times new roman') GUICtrlCreateLabel("PARM = ",200,15,75,25) Local $parm = GUICtrlCreateEdit('',250,10,75,25,$ss_sunken) GUICtrlSetFont($parm,12,800) GUICtrlSetState($parm,$gui_focus) Local $Edit010 = GUICtrlCreateEdit("", 10,40,780,550, $ES_AUTOVSCROLL + $WS_VSCROLL + $ws_hscroll + $es_readonly) GUICtrlSetFont(-1,8.5,800,default,'courier new') GUISetState(@SW_SHOW) net_properties() Func net_properties() Local $rslt,$out While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 $rslt = Run(@ComSpec & " /c ipconfig " & GUICtrlRead($parm), @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD) ; Will Run ipco.exe that exist in the same folder as the script While 1 $out = StdoutRead($rslt) If @error then exitloop GUICtrlSetData($edit010,$out & @lf,1) WEnd Case $msg = $Button2 $rslt = Run(@ComSpec & " /c netstat " & GUICtrlRead($parm), @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD) ; Will Run ipco.exe that exist in the same folder as the script While 1 $out = StdoutRead($rslt) If @error then exitloop GUICtrlSetData($edit010,$out & @lf,1) WEnd Case $msg = $clear GUICtrlSetData($edit010,"") EndSelect WEnd EndFunc kylomas1 point
-
armoros, SLightly different from BrewmanNH but same concept (can't type as fast as the Brewman) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Constants.au3> Local $Button1, $Button2, $msg, $edit010 $Form1 = GUICreate("Network Properties", 400, 400) $Button1 = GUICtrlCreateButton("ipconfig",10, 10, 75, 25) $Button2 = GUICtrlCreateButton("netstat", 315, 10, 75, 25) $Edit010 = GUICtrlCreateEdit("", 10,40,380,300, $ES_AUTOVSCROLL + $WS_VSCROLL + $ws_hscroll + $es_readonly) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### asssdd() Func asssdd() Local $rslt,$out While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 $rslt = Run(@ComSpec & " /c ipconfig", @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD) ; Will Run ipco.exe that exist in the same folder as the script While 1 $out = StdoutRead($rslt) If @error then exitloop GUICtrlSetData($edit010,$out & @lf,1) WEnd Case $msg = $Button2 $rslt = Run(@ComSpec & " /c netstat", @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD) ; Will Run ipco.exe that exist in the same folder as the script While 1 $out = StdoutRead($rslt) If @error then exitloop GUICtrlSetData($edit010,$out & @lf,1) WEnd EndSelect WEnd EndFunc kylomas1 point
-
Try this, compile it, then run the resulting exe and see what it does. #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** GUICreate("") $button = GUICtrlCreateButton(" IPConfig ", 20, 20) $button2 = GUICtrlCreateButton(" NetStat ", 20, 70) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $button _IPConfig() Case $button2 _NetStat() EndSwitch WEnd Func _IPConfig() $PID = Run("ipconfig /all", "", @SW_HIDE, 8) While ProcessExists($PID) $line = StdoutRead($PID) If @error Then ExitLoop If $line <> "" Then ConsoleWrite($line & @CRLF) WEnd EndFunc ;==>_IPConfig Func _NetStat() $PID = Run("netstat", "", @SW_HIDE, 8) While ProcessExists($PID) $line = StdoutRead($PID) If @error Then ExitLoop If $line <> "" Then ConsoleWrite($line & @CRLF) WEnd EndFunc This is just a quick demo and you can prettify it however you'd like, but it gives you the general idea of what I'm talking about.1 point
-
It's possible, but you need 2 different scripts. If you create a console script WITHOUT GUI and compile it with the option "Create CUI instead of GUI EXE", your compiled script, if run from the cmd box, will read from the cmd box and output to it. That compiled script could launch another autoit script with a GUI and wait for its disappearence or a command from it before it exits. That second (GUI) script has buttons and is compiled with the GUI option. With this setup, the 2 scripts can talk to each other, communicate data, one can read the cmd box and write to it, it's the "puppet", the GUI one is the "puppet master".1 point
-
armoros, You'll have to wait for someone with expertise to answer. I rarely, if ever, use the CMD window. Good Luck, kylomas1 point
-
armoros, Your variable names do NOT match...$Button_1 in the select stmt, but, $Button1 in the definition... kylomas1 point
-
RDP Session In AutoIT Gui
Colduction reacted to UEZ for a topic
Try this uncomplete version: #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> $host = "" ;<<<<<<< enter here the host name or ip address ;Remote Desktop ActiveX Control Interfaces -> http://msdn.microsoft.com/en-us/library/aa383022(v=VS.85).aspx $hGUI = GUICreate("RDP Embedded Sessions", 952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 64, 44, 800, 600) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) $oRDP.DesktopWidth = 800 $oRDP.DesktopHeight = 600 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $oRDP.Server = $host $oRDP.UserName = "" ;<<<<<<< enter here the user name $oRDP.Domain = "" $oRDP.AdvancedSettings2.ClearTextPassword = "" $oRDP.ConnectingText = "Connecting to " & $host $oRDP.DisconnectedText = "Disconnected from " & $host $oRDP.StartConnected = True $oRDP.Connect() GUISetState(@SW_SHOW, $hGUI) ;~ ConsoleWrite($oRDP.GetErrorDescription() & @CRLF) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $oRDP.Disconnect() Exit EndSwitch WEnd It will open a RDP session embedded in the GUI. Br, UEZ1 point