Jump to content

Need help with script


Kraviks
 Share

Recommended Posts

ok, I got this so far. However, I need to know how to stop a macro in the middle of everything. How do I add breaks after each MouseUp so if I release the hotkey, it will not continue to play out the script.

#include <GUIConstantsEx.au3>
#include <Misc.au3>

$hGUI = GUICreate("Testing", 300, 160)
$idCheckbox1 = GUICtrlCreateRadio("Hold Down Right Mouse", 10, 10, 125, 25)
$idCheckbox2 = GUICtrlCreateRadio("Hold Down Left Mouse", 10, 30, 125, 25)
$idClose = GUICtrlCreateButton("Close", 210, 130, 85, 25)
GUISetState()

While 1
 _Run()
  Switch GUIGetMsg()
     Case $GUI_EVENT_CLOSE, $idClose
           ExitLoop
  EndSwitch
WEnd


Func _Run()
   If _IsPressed("5A") Then
       If _IsChecked($idCheckbox1) Then
          Do
             MouseDown("Right")
             Sleep(500)
             MouseUp("Right")
             Sleep(500)
             MouseDown("Right")
             Sleep(500)
             MouseUp("Right")
             Sleep(500)
         MouseDown("Right")
             Sleep(500)
             MouseUp("Right")
             Sleep(500)
         MouseDown("Right")
             Sleep(500)
             MouseUp("Right")
             Sleep(500)
          Until not _IsPressed("5A")
      EndIf
      If _IsChecked($idCheckbox2) Then
          Do
             MouseDown("Left")
             Sleep(500)
             MouseUp("Left")
             Sleep(500)
          Until not _IsPressed("5A")
      EndIf
  EndIf
EndFunc

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked
Link to comment
Share on other sites

HotKeySet("{PAUSE}", "TogglePause")

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

Insert:

send("{PAUSE}")

where you want the script to stop. Press the paused key to continue.

Your code looks a little bit messy. If I understood what you were trying to do I could better tell you what to do. If you want the script to pause after a mouseup event then I would use msgbox.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Moderators

Kraviks,

I do not appreciate you opening a new thread when I have just locked your previous one on the same subject. And as for sending me a PM explaining that "it was only for learning" - how many times have I heard that one. :whistle:

Consider yourself lucky that I am not sanctioning you - but do NOT open a third thread on this matter. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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