Sign in to follow this  
Followers 0
neverbr

Text () and / changing valor.

6 posts in this topic

#1 ·  Posted (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 by neverbr

Share this post


Link to post
Share on other sites



Ps. the window run minimized or in background, so need to tell which window title will send the command.

Share this post


Link to post
Share on other sites

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(" ") ??

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

#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 :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0