Sign in to follow this  
Followers 0
BloodRain

[Question] How to run script in hidden process?

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



 

Add

#NoTrayIcon

Tks but I mean example if Firefox with tab "Tab Press Key" hide using WinSetState('Tab Press key', '', @SW_HIDE); then script not run on it!

I have to showing tab "Tab Press Key". I need script run with Firefox hidden!

Share this post


Link to post
Share on other sites

helpppppppppppppppppp meeeeeeeeeeeeeeeeeeeee pleaseeeeeeeeeeeeeeeeeeeeeeee!

Share this post


Link to post
Share on other sites

helpppppppppppppppppp meeeeeeeeeeeeeeeeeeeee pleaseeeeeeeeeeeeeeeeeeeeeeee!

 

Please read our forumrules in relation to bumping threads.

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

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

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