Sign in to follow this  
Followers 0
Chobyhy

Script Help!

16 posts in this topic

Someone helped me write a script but it didnt work and it created massive lag

#include <misc.au3>

While 1
    If _IsPressed(0x70) Then
        Send("x")
        Send("{LSHIFT DOWN}")
        MouseDown("Left")
    If _IsPressed(0x70) = 0 Then
        Send("{LSHIFT UP}")
        MouseUp("Left")
        Send("y")
    EndIf
    EndIf
WEnd
Sleep(100000)

This is how it was suppose to work. When a user holds down F1, the script will hit button "x" and then hold down left shift and mouse will click and hold clicking on the screen and when F1 is released, Shift and mouse clicks will release and it will hit button "x". can anyone help me to fix it ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <misc.au3>

$ButtonPressed = 0

While 1
    If _IsPressed(0x70) Then
        If $ButtonPressed = 0 Then
            Send("x")
            Send("{LSHIFT DOWN}")
            MouseDown("Left")
            $ButtonPressed = 1
        EndIf
    ElseIf $ButtonPressed = 1 Then
        Send("{LSHIFT UP}")
        MouseUp("Left")
        Send("x")
        $ButtonPressed = 0
    EndIf
    Sleep(15)
WEnd

Try this. I "think" it's what you want.

Nomad :D

Edited by Nomad

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

alright ill try it and see if it works. thx nomad you answered basically all my posts and questions =D

nothing happens...

Edited by Chobyhy

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

alright ill try it and see if it works. thx nomad you answered basically all my posts and questions =D

nothing happens...

Hmm, I don't know if I'm reading this right, but try this:
#include <misc.au3>

While 1
    If _IsPressed('70') Then
        Send('{LSHIFT DOWN}')
        While _IsPressed('70') ;While the key is being pressed
            Send('x')
            MouseClick("Left")
            Sleep(100)
        WEnd
        Send('{LSHIFT UP}y')
    EndIf
    Sleep(10)
WEnd
Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

finally we're getting somewhere. okay your script works for half the part. When f1 is clicked button x is confirmed that it was clicked and mouse is holding onto the screen as long as im holding on to f1 but the shift is not registering. and when i release f1 its suppose to hit y but "y" button doesnt get hit also.

Edit: okay Y button does get hit nvm it works cept the shift. but some times when f1 is released it does a additional shuffle between x and y

o okay i fixed it can you take a look at it and see if its all good?

#include <misc.au3>

While 1
    If _IsPressed('70') Then
        While _IsPressed('70') ;While the key is being pressed
            Send('x')
            Send('{LSHIFT DOWN}')
            MouseClick("Left")
            Sleep(100)
        WEnd
        Send('{LSHIFT UP}y')
    EndIf
    Sleep(10)
WEnd

is there anyways to make button "y" presses faster as soon as f1 gets released. there is a few milisecond delay i want to get rid of=(

wait im wondering is X being held down also as long as F1 is pressed? cuz i just need to tap X just once not hold it forever..

Edited by Chobyhy

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <misc.au3>
Opt('SendKeyDelay', 1)
While 1
    If _IsPressed('70') Then
        Send('x')
        While _IsPressed('70') ;While the key is being pressed
            Send('{LSHIFT DOWN}')
            MouseClick("Left")
            Sleep(100)
        WEnd
        Send('{LSHIFT UP}y')
    EndIf
    Sleep(10)
WEnd

Edit:

Personally, I don't like the LSHIFT DOWN in the loop itself... once it's down, it doesn't come back up again until you press shift manually or use LSHIFT UP.

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Didnt you tell me you wanted it to hold mouse down?

MouseDown("Left") Instead of mouseclick?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Didnt you tell me you wanted it to hold mouse down?

MouseDown("Left") Instead of mouseclick?

He's changed it several times I've noticed... In his 1st post, he referred to "Click" several times, so I changed it from Down to Click.

[center]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.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Cause the example was my dodgy try.

EDIT::

I failed miserably xD

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Cause the example was my dodgy try.

EDIT::

I failed miserably xD

:D:wacko:

What are you talking about :D


[center]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.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

His first post, I helped him get there through msn

EDIT::

And failed

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

grr damnit no one understands what im talking about. the script is working fine i think

#include <misc.au3>

While 1
    If _IsPressed('70') Then
        While _IsPressed('70') ;While the key is being pressed
            Send('x')
            Send('{LSHIFT DOWN}')
            MouseClick("Left")
            Sleep(100)
        WEnd
        Send('{LSHIFT UP}y')
    EndIf
    Sleep(10)
WEnd

this is the description. When F1 gets Held down meaning it is kept getting pressed, it hits x once! not hold it down too but holds down mouse left click on the screen along with shift held down. mouse click and shift gets released meaning no more holding down when i release F1 and once it gets released i need instant button "y" hit

now the question is. x is being tapped only once right not being held down and is there anyways to make y tapped instantly, meaning faster press cuz there is a delay like few millisecond that i want to get rid of =(

Share this post


Link to post
Share on other sites

grr damnit no one understands what im talking about. the script is working fine i think

#include <misc.au3>

While 1
    If _IsPressed('70') Then
        While _IsPressed('70') ;While the key is being pressed
            Send('x')
            Send('{LSHIFT DOWN}')
            MouseClick("Left")
            Sleep(100)
        WEnd
        Send('{LSHIFT UP}y')
    EndIf
    Sleep(10)
WEnd

this is the description. When F1 gets Held down meaning it is kept getting pressed, it hits x once! not hold it down too but holds down mouse left click on the screen along with shift held down. mouse click and shift gets released meaning no more holding down when i release F1 and once it gets released i need instant button "y" hit

now the question is. x is being tapped only once right not being held down and is there anyways to make y tapped instantly, meaning faster press cuz there is a delay like few millisecond that i want to get rid of =(

Grrr back at you... I answered your question in post #6 if that's not it, then play with it until it is.

[center]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.[/center]

Share this post


Link to post
Share on other sites

how did you answer it? it says it doesnt get back up but it does get back up =D now how do i get rid of that delay??

Share this post


Link to post
Share on other sites

how did you answer it? it says it doesnt get back up but it does get back up =D now how do i get rid of that delay??

Blah, Just look at it... This is my last post here, because you obviously aren't putting any effort into it yourself. What do you see different in that script that I posted in #6 vs # 4? The Send('x') is in a different place and there is a new option to make it send the keys quicker (Hint: Opt('SendKeyDelay', 1)).

[center]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.[/center]

Share this post


Link to post
Share on other sites

o man i see it now. i was abit busy experienmenting with other script so i rushed through it i thought u just wrote same thing. okay ill try that out thx man.

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