Jump to content

Switcher


Go to solution Solved by SOLVE-SMART,

Recommended Posts

Hey, 

doing small stuff in AutoIt just for training and feeling nice with it. 

 

Have already script builded for my needes,

but asking you guys for help with Turn ON/OFF Func.

 

 

#include <misc.au3>
HotKeySet("1", "start")
HotKeySet("2", "stop")

Func start();
    MouseDown("middle")
EndFunc

Func stop();
    MouseUp("middle")
EndFunc

 

Looking for solution to switch Mouse down/up with 1 key 

 

Link to post
Share on other sites

Hi @SevenScript,

I guess you are looking for a toggle function. Please search the forum for toggle and you will get examples that are similar to your question.

I don't have enough time at the moment to script a quick script as an example, because I am in rush. Maybe later today.

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔍 Forum search

🔮 Me on GitHub

💬 Opinion about new forum sub category

 📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to post
Share on other sites

and when tray no needed this just with HotKey

#include <misc.au3>

Local $Enabled, $SleepTime
Enabled()

While 1
    Sleep($SleepTime)
WEnd

Func start();
    ;MouseDown("middle")
    MouseWheel("down")
EndFunc

Func stop();
    ;MouseUp("middle")
    MouseWheel("up")
EndFunc

Func Enabled()
    if $Enabled = True Then
        $Enabled = False
        $SleepTime = 1000
        HotKeySet("1")
        HotKeySet("2")
    Else
        $Enabled = True
        $SleepTime = 10
        HotKeySet("{ESC}", "Enabled")
        HotKeySet("1", "start")
        HotKeySet("2", "stop")
    EndIf
ConsoleWrite("$Enabled=" & $Enabled & @CRLF)

EndFunc

 

Edited by ioa747
Link to post
Share on other sites
  • Solution

To be honest @ioa747,

I was actually thinking about such toggle function:

HotKeySet('{ESC}', '_Exit')
HotKeySet('1', '_ToggleMouse')

Global $bIsDown = False

Func _Exit()
    Exit
EndFunc

Func _ToggleMouse()
    $bIsDown = Not $bIsDown

    If $bIsDown Then
        MouseDown('middle')

        Return
    EndIf

    MouseUp('middle')
EndFunc

While True
    Sleep(200)
WEnd

Simply press "1" to do the mouse down ("middle" key) action and press "1" again for the mouse up action (and again and again 😅).
I think this is exactly what @SevenScript wanted to know, am I right?

Best regards
Sven

Edited by SOLVE-SMART

Stay innovative!

Spoiler

🌍 Au3Forums

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔍 Forum search

🔮 Me on GitHub

💬 Opinion about new forum sub category

 📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to post
Share on other sites

@SOLVE-SMART  You have right !

my eye  stayed to

On 1/23/2023 at 6:10 AM, SevenScript said:

but asking you guys for help with Turn ON/OFF Func

than in

On 1/23/2023 at 6:10 AM, SevenScript said:

Looking for solution to switch Mouse down/up with 1 key 

 

Thanks for suggestions.  :)

Link to post
Share on other sites

You're welcome @ioa747 🤝 .

Stay innovative!

Spoiler

🌍 Au3Forums

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔍 Forum search

🔮 Me on GitHub

💬 Opinion about new forum sub category

 📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...