Jump to content

little noob script


oNNoZeLe
 Share

Recommended Posts

Hi all,

I have a little question. Ofcourse..

I did a little with autoit a few years ago just to simulate some mouse patterns.

But now i wanted something more advanced and checked autoit again and it blew me right out of my shoes.. :)

What has this 'little tool' advanced in the years..

but here's the thing.

I still want some mouse movement but i want it to repeat itself every 5 minutes.. So i tried to write some code but it isn't really working.

I got most of the time stuck on a stupid progressbar.. :"> (what still isn't working)

here's the codem, could someone hand me some hints?

thanks in advance:

#include <GuiConstants.au3>

opt("TrayIconDebug",1)
Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode 
GuiCreate("Keep OMA alive", 280, 127,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(10, 20, 260, 30)
$enable_button = GuiCtrlCreateButton("Enable", 10, 50, 260, 30)
$disable_button = GuiCtrlCreateButton("Disable", 10, 90, 260, 30)

GUICtrlSetOnEvent($enable_button, "enable")
GUICtrlSetOnEvent($disable_button, "disable")
GUISetState(@SW_SHOW)

While 1
 $msg = GUIGetMsg()
 Select
     Case $msg = $GUI_EVENT_CLOSE
        Exit
  EndSelect
Wend


Func update_progress ()

    
    
EndFunc

Func enable()
  dim $i = 0
  dim $v = $i/300
    
    If $i <= 30000 Then 
        ;Sleep(1000) 
        $i = $i + 1 
        GUICtrlSetData($Progress_1,$v)
    Else
        $i = 0
        GUICtrlSetData($Progress_1,$v)
        do_your_thing
    EndIf   

EndFunc

Func disable()
  Exit
EndFunc


func do_your_thing ()
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("OMA Order Management Administratie","  Af te drukken kolo")
If Not WinActive("OMA Order Management Administratie","  Af te drukken kolo") Then WinActivate("OMA Order Management Administratie","  Af te drukken kolo")
WinWaitActive("OMA Order Management Administratie","  Af te drukken kolo")
MouseMove(79,95)
MouseDown("left")
MouseUp("left")
Sleep(1000)
MouseMove(1149,92)
MouseDown("left")
MouseUp("left")
Sleep(1000)
MouseMove(1006,856)
MouseDown("left")
MouseUp("left")
Sleep(1000)
MouseMove(1232,13)
MouseDown("left")
MouseUp("left")
Sleep(1000)
WinWait("classname=Shell_TrayWnd","")
If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","")
WinWaitActive("classname=Shell_TrayWnd","")
MouseMove(237,26)
MouseDown("left")
MouseUp("left")
Sleep(1000)
MouseMove(237,22)
MouseDown("left")
MouseUp("left")
Sleep(1000)
EndFunc
Link to comment
Share on other sites

  • Moderators

CODE
#include <GuiConstants.au3>

Opt("TrayIconDebug", 1)

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

GUICreate("Keep OMA alive", 280, 127, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GUICtrlCreateProgress(10, 20, 260, 30)

$enable_button = GUICtrlCreateButton("Enable", 10, 50, 260, 30)

$disable_button = GUICtrlCreateButton("Disable", 10, 90, 260, 30)

GUICtrlSetOnEvent($enable_button, "_enable")

GUICtrlSetOnEvent($disable_button, "_disable")

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

Func update_progress()

EndFunc

Func _enable()

Local $i = 0

While 1 ;It was never looping

Local $v = $i / 300

If $i <= 30000 Then

;Sleep(1000)

$i += 1

GUICtrlSetData($Progress_1, $v)

Else

$i = 0

GUICtrlSetData($Progress_1, $v)

_do_your_thing();Must call the function correctly ()<< forgot that

;~========= AdlibEnable ========

AdlibEnable('_do_your_thing', ((60 * 1000) * 5)); 60 * 1000 = 60 seconds * 5 = 5 minutes

;~=============================

EndIf

WEnd

EndFunc

Func _disable()

Exit

EndFunc

Func _do_your_thing()

Opt("WinWaitDelay", 100)

Opt("WinTitleMatchMode", 4)

Opt("WinDetectHiddenText", 1)

Opt("MouseCoordMode", 0)

WinWait("OMA Order Management Administratie", " Af te drukken kolo")

If Not WinActive("OMA Order Management Administratie", " Af te drukken kolo") Then WinActivate("OMA Order Management Administratie", " Af te drukken kolo")

WinWaitActive("OMA Order Management Administratie", " Af te drukken kolo")

MouseMove(79, 95)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1149, 92)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1006, 856)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1232, 13)

MouseDown("left")

MouseUp("left")

Sleep(1000)

WinWait("classname=Shell_TrayWnd", "")

If Not WinActive("classname=Shell_TrayWnd", "") Then WinActivate("classname=Shell_TrayWnd", "")

WinWaitActive("classname=Shell_TrayWnd", "")

MouseMove(237, 26)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(237, 22)

MouseDown("left")

MouseUp("left")

Sleep(1000)

EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...