Jump to content

Script Help!


Recommended Posts

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 ?

Link to comment
Share on other sites

#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
Link to comment
Share on other sites

  • Moderators

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

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

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
Link to comment
Share on other sites

  • Moderators

#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

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

  • Moderators

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.

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

  • Moderators

Cause the example was my dodgy try.

EDIT::

I failed miserably xD

:D:wacko:

What are you talking about :D

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

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 =(

Link to comment
Share on other sites

  • Moderators

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.

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

  • Moderators

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

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