Jump to content

Run script on an unfocused window so I can stull use computer while it runs?


Recommended Posts

if you mean send keys to unactivated window then you should see

ControlClick , ControlSend .

good luck,

I tried to look it up but I dont exactly understand the syntax of its usage.

If I may, I will post the code and if you could demonstrate a little on how to actually use the code, I would be great appreciative. I will just follow your lead to complete the rest. the window name is "Darkfall Online" and it is darkfall.exe

; Lesser Magic Leveling Macro With Weapon Refresh.
; Rewritten and Modified By MostHated
; Original by Ices
; 2009

Dim $Variable, $MM, $Rest, $MMhotkey, $SelfHealHotkey, $RestHotKey, $StaffHotkey, $OtherWeapon
Global $Paused
HotKeySet("`", "TogglePause")
HotKeySet("{DEL}", "Terminate")

$MM = ( "18" ) ; Number of Mana Missiles to fire
$Rest = ( "100000" ) ; Amount of time to rest
$MMhotkey = ( "5" ) ; Mana Missile hotkey
$SelfHealHotkey = ( "1" ) ; Self Heal hotkey
$RestHotKey = ( "0" ) ; Rest hotkey
$Launch = ( "2" ) ; Including launch in sequence, 1 for yes 2 for no.
$StaffHotkey = "7"
$OtherWeapon = "8"

If $Launch = 1 Then
    $LaunchHoyKey = ( "4" )
MsgBox( 0, "Alert", "Click OK then Alt + Tab into Darkfall to start the script." )
WinWaitActive( "Darkfall Online" )

While 1
    $Variable = 0
    Sleep ( 2000 )
    Send( "R" )
    Sleep ( 500 )
    Call( "Launch" )
    Call( "HealSelf" )

    Do
        Call( "ManaMissile" )
        $Variable = $Variable + 1
    Until $Variable = $MM
    Sleep( 500 )
    Call( "Launch" )
    Call( "HealSelf" )
    Sleep( 2500 )
    Call( "Rest" )
WEnd

ElseIf $Launch = 2 Then
    MsgBox( 0, "Alert", "Click OK then Alt + Tab into Darkfall to start the script." )
    WinWaitActive( "Darkfall Online" )

While 1
    $Variable = 0
    Sleep ( 2000 )
    Send( "R" )
    Sleep ( 500 )
    Call( "HealSelf" )

    Do
        Call( "ManaMissile" )
        $Variable = $Variable + 1
    Until $Variable = $MM
    Sleep( 2500)
    Call( "Refreshweapon" )
    Sleep( 5000 )
    Call( "HealSelf" )
    Sleep( 2500 )
    Call( "Rest" )
WEnd

Else
    MsgBox( 0, "Alert", "Error." )
    Exit
EndIf

Func Refreshweapon( )
    Sleep( 2500)
    Send( $OtherWeapon )
    Sleep( 5000 )
    Send( $StaffHotkey )
    Sleep( 2500 )
    EndFunc

Func HealSelf( )
    Sleep( 500 )
    Send( $SelfHealHotkey )
    Sleep( 500 )
    MouseClick( "Left" )
    Sleep( 2400 )
EndFunc

Func ManaMissile( )
    Sleep( 500 )
    Send( $MMhotkey )
    Sleep( 500 )
    MouseClick( "Left" )
    Sleep( 1500 )
    EndFunc

Func Rest( )
    Sleep( 2000 )
    Send( "R" )
    Sleep( 500 )
    Send( $RestHotKey )
    Sleep( 500 )
    MouseClick( "Left" )
    Sleep( $Rest )
    Send( "{SPACE}" )
    Sleep( 500 )
EndFunc

Func Launch( )
    Sleep( 1000 )
    Send( $LaunchHoyKey )
    Sleep( 500 )
    MouseClick( "Left" )
    Sleep( 6000 )
EndFunc

Func TogglePause( )
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate( )
    Exit 0
EndFunc
Link to comment
Share on other sites

ControlClick: http://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm

ControlCommand: http://www.autoitscript.com/autoit3/docs/functions/ControlCommand.htm

Function list: http://www.autoitscript.com/autoit3/docs/functions.htm

Edited by darthneo
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...