neverbr Posted August 12, 2012 Share Posted August 12, 2012 (edited) Hi, I'm tryng to send some solidus and parenthesis command to a program console like: /run Rodar() I'm using: ControlSend("Program Title", "", "", "/run Rodar()') But it returns to me on console: qrun rodar90 what i'm doing wrong? Edited August 12, 2012 by neverbr Link to comment Share on other sites More sharing options...
neverbr Posted August 12, 2012 Author Share Posted August 12, 2012 Ps. the window run minimized or in background, so need to tell which window title will send the command. Link to comment Share on other sites More sharing options...
rockscena Posted August 12, 2012 Share Posted August 12, 2012 Ps. the window run minimized or in background, so need to tell which window title will send the command. Until and Unless u write a full code we cant understand , else as per ur 2nd statement .. did u sent command WinActive(" ") and WinActivate(" ") ?? Link to comment Share on other sites More sharing options...
neverbr Posted August 12, 2012 Author Share Posted August 12, 2012 expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Set a HotKey HotKeySet("x", "_Interrupt") ; Declare a flag $fInterrupt = 0 $hGUI = GUICreate("Never Program", 210, 40) $hButton_1 = GUICtrlCreateButton("Never", 10, 10, 50, 20) $hButton_2 = GUICtrlCreateButton("Log On", 80, 10, 50, 20) $hButton_3 = GUICtrlCreateButton("Log Off", 150, 10, 50, 20) ; Create a dummy control for the Accelerator to action when pressed $hAccelInterupt = GUICtrlCreateDummy() ; Set an Accelerator key to action the dummy control Dim $AccelKeys[1][2]=[ ["z", $hAccelInterupt] ] GUISetAccelerators($AccelKeys) GUISetState() ; Intercept Windows command messages with out own handler GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_1 _Func_1() Case $hButton_2 _Func_2() Case $hButton_3 _Func_3() EndSwitch WEnd Func _Func_1() ToolTip('Rodando',0,0) While 1 ControlSend("Never Program", "", "", "{ENTER}") Sleep(Random(60000,240000)) WEnd EndFunc Func _Func_2() ; Make sure the flag is cleared $fInterrupt = 0 For $i = 1 To 20 ToolTip('Log on',0,0) While 1 ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{ENTER}") ControlSend("Never Program", "", "", "/run Rodar()") ControlSend("Never Program", "", "", "{ENTER}") Sleep(Random(300000,600000)) WEnd ; Look for the flag If $fInterrupt <> 0 Then ; The flag was set Switch $fInterrupt Case 1 ToolTip("Interrompendo...") Sleep(2000) Case 2 ToolTip("Fechando...") Sleep(2000) Case 3 ConsoleWrite("!Func 1 interrrupted by Accelerator" & @CRLF) EndSwitch Return EndIf Sleep(100) Next ConsoleWrite(">Func 1 Ended" & @CRLF) EndFunc Func _Func_3() For $i = 1 To 3 ToolTip("Logger Interrompido...") Sleep(100) Next ConsoleWrite(">Func 2 Ended" & @CRLF) EndFunc Func _Interrupt() ; The HotKey was pressed so set the flag $fInterrupt = 2 EndFunc Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) ; The Func 2 button was pressed so set the flag If BitAND($wParam, 0x0000FFFF) = $hButton_3 Then $fInterrupt = 1 ; The dummy control was actioned by the Accelerator key so set the flag If BitAND($wParam, 0x0000FFFF) = $hAccelInterupt Then $fInterrupt = 3 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND i'm using a sample example of AutoIt to do 3 buttons GUI one that run an program and other two to run and stop a function. sorry about my noob question lol Link to comment Share on other sites More sharing options...
rockscena Posted August 12, 2012 Share Posted August 12, 2012 expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Set a HotKey HotKeySet("x", "_Interrupt") ; Declare a flag $fInterrupt = 0 $hGUI = GUICreate("Never Program", 210, 40) $hButton_1 = GUICtrlCreateButton("Never", 10, 10, 50, 20) $hButton_2 = GUICtrlCreateButton("Log On", 80, 10, 50, 20) $hButton_3 = GUICtrlCreateButton("Log Off", 150, 10, 50, 20) ; Create a dummy control for the Accelerator to action when pressed $hAccelInterupt = GUICtrlCreateDummy() ; Set an Accelerator key to action the dummy control Dim $AccelKeys[1][2]=[ ["z", $hAccelInterupt] ] GUISetAccelerators($AccelKeys) GUISetState() ; Intercept Windows command messages with out own handler GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_1 _Func_1() Case $hButton_2 _Func_2() Case $hButton_3 _Func_3() EndSwitch WEnd Func _Func_1() ToolTip('Rodando',0,0) While 1 ControlSend("Never Program", "", "", "{ENTER}") Sleep(Random(60000,240000)) WEnd EndFunc Func _Func_2() ; Make sure the flag is cleared $fInterrupt = 0 For $i = 1 To 20 ToolTip('Log on',0,0) While 1 ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{BACKSPACE}") ControlSend("Never Program", "", "", "{ENTER}") ControlSend("Never Program", "", "", "/run Rodar()") ControlSend("Never Program", "", "", "{ENTER}") Sleep(Random(300000,600000)) WEnd ; Look for the flag If $fInterrupt <> 0 Then ; The flag was set Switch $fInterrupt Case 1 ToolTip("Interrompendo...") Sleep(2000) Case 2 ToolTip("Fechando...") Sleep(2000) Case 3 ConsoleWrite("!Func 1 interrrupted by Accelerator" & @CRLF) EndSwitch Return EndIf Sleep(100) Next ConsoleWrite(">Func 1 Ended" & @CRLF) EndFunc Func _Func_3() For $i = 1 To 3 ToolTip("Logger Interrompido...") Sleep(100) Next ConsoleWrite(">Func 2 Ended" & @CRLF) EndFunc Func _Interrupt() ; The HotKey was pressed so set the flag $fInterrupt = 2 EndFunc Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) ; The Func 2 button was pressed so set the flag If BitAND($wParam, 0x0000FFFF) = $hButton_3 Then $fInterrupt = 1 ; The dummy control was actioned by the Accelerator key so set the flag If BitAND($wParam, 0x0000FFFF) = $hAccelInterupt Then $fInterrupt = 3 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND i'm using a sample example of AutoIt to do 3 buttons GUI one that run an program and other two to run and stop a function. sorry about my noob question lol In this script modify like this to gain control case $hbutton1 If GuiCtrlGet($hbutton1) = 1 Then /// Ur Script for enabling the button wether its a UDF's or Control Step by Step process /// ElseIf / Endif <as per ur needs> Hope this may help u out.. , well just wait 4 some more time , if anybody improvises ur idea.. bt as far as i am concerned this will wrk out Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 12, 2012 Share Posted August 12, 2012 tryControlSend("Program Title", "", "", chr(47)&"run Rodar"&chr(40)&chr(41)) 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now