Jump to content

[Question] How to run script in hidden process?


 Share

Recommended Posts

Sorry for my English but I have question: My Script designed for loops press some key if tab name "Tab Press key" activated.

But if I hide this tab, script not run in hide process. How to?

That my code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.10.2
 Author:         BloodRain

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
HotKeySet("^z", "a")
HotKeySet("^x", "b")
HotKeySet("^c", "c")
HotKeySet("^v", "ex")
Local $Timer1, $Delay1 = 100
Local $Timer2, $Delay2 = 5000

While 1
   Sleep(100)
WEnd

Func a()
WinWaitActive('Tab Press key');
Sleep(1000);
While 1
    If $Timer1 = '' Or TimerDiff($Timer1) > $Delay1 Then
        $Timer1 = TimerInit()
        Action1()
    EndIf
    If $Timer2 = '' Or TimerDiff($Timer2) > $Delay2 Then
        $Timer2 = TimerInit()
        Action2()
    EndIf
; Briefly pause to avoid excessive CPU usage
    Sleep(100)
WEnd
EndFunc

Func b()
WinSetState('Tab Press key', '', @SW_HIDE);
EndFunc

Func c()
WinSetState('Tab Press Key', '', @SW_SHOW);
   EndFunc


Func Action1()
   Local $arr[] = ["{LEFT}", "{DOWN}", "{RIGHT}", "{UP}"]
   Sleep(100)
   $i = Random(0, 3, 1)
   Send($arr[$i])
EndFunc

Func Action2()
   MouseClick("left", 359, 623)
EndFunc

Func ex()
   Exit 0;
EndFunc

Please help!

Edited by BloodRain
Link to comment
Share on other sites

  • Developers

helpppppppppppppppppp meeeeeeeeeeeeeeeeeeeee pleaseeeeeeeeeeeeeeeeeeeeeeee!

 

Please read our forumrules in relation to bumping threads.

As far as I understand your question you want the impossible,

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Please read our forumrules in relation to bumping threads.

As far as I understand your question you want the impossible,

Jos

 

Thank you, it's work now, but WinSetStage hide not work on Firefox: hiden some seconds and auto show =((

 

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.10.2
 Author:         BloodRain

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
HotKeySet("^{F1}", "a")
HotKeySet("^{F2}", "b")
HotKeySet("^{F3}", "c")
HotKeySet("^{F4}", "ex")
Local $Timer1, $Delay1 = 100
Local $Timer2, $Delay2 = 9000

While 1
   Sleep(100)
WEnd

Func a()
WinWaitActive('Tab Press key')
Sleep(2000)
While 1
    If $Timer1 = '' Or TimerDiff($Timer1) > $Delay1 Then
        $Timer1 = TimerInit()
        Action1()
    EndIf
    If $Timer2 = '' Or TimerDiff($Timer2) > $Delay2 Then
        $Timer2 = TimerInit()
        Action2()
    EndIf
; Briefly pause to avoid excessive CPU usage
    Sleep(10)
WEnd
EndFunc

Func b()
WinSetState("Tab Press key", "", @SW_HIDE)
EndFunc

Func c()
WinSetState("Tab Press key", "", @SW_SHOW)
   EndFunc

Func Action1()
   Local $arr[4] = ["{UP}", "{LEFT}", "{DOWN}", "{RIGHT}"]
   Sleep(100)
   $i = Random(0, 3, 1)
   ControlSend("Tab Press key", "", "" , $arr[$i])
EndFunc

Func Action2()
   ControlClick("Tab Press key", "", "", "left", 1, 357, 661)
EndFunc

Func ex()
   Exit 0;
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...