frequent errors even in the published lists

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
techila
Posts: 3
Joined: 25 Jun 2018, 05:41

frequent errors even in the published lists

25 Jun 2018, 11:43

hi, I'm testing to get experience with the program, and I copied the following script to copy and paste a selected text:

Code: Select all

~ LButton ::; Make the left mouse button a hotkey, but allow it to function as normal.
MouseGetPos, xA, yA
loop; Looped begin.
{
    duration: = 0
    if (GetKeyState, LButtonState, LButton, P)
    {
        start: = A_TickCount
        While (GetKeyState, LButtonState, LButton, P)
            Sleep, 1
        duration: = A_TickCount - start

    }
    if (duration> 100)
  {
    MouseGetPos, xB, yB
    Transform, xA, abs,% xA%; Return the absolute value of xA.
    Transform, xB, abs,% xB%
    Transform, yA, abs,% yA%
    Transform, yB, abs,% yB%
    xDiff = 0
    xDiff + =% xA%; Add xA to xDiff.
    xDiff - =% xB%; Subtract xA from xDiff.
    Transform, xDiff, abs,% xDiff%
    yDiff = 0
    yDiff + =% yA%
    yDiff - =% yB%
    Transform, yDiff, abs,% yDiff%
    diffSum = 0
    diffSum + =% xDiff%
    diffSum + =% yDiff%
    If diffSum> 10
    {
      Send, ^ c; Copy.
      clipboard =% clipboard%; Convert the cliboard contents to plain text.
    }
    break
  }
}
return

MButton ::; Make the middle mouse button a hotkey, and _don't_ allow it to function as normal.
send, ^ v; Paste
return
but when I go to compile it gives me the following error:

error at line 11

line text: while (getkeystate, lbuttonstate, lbutton, p)
error: this line does not contain a recognized action
the program will exit.

now the fact is that it seems strange that it has been spelled wrong, the author gives it to work and I have done copy and paste. What could be the cause.

note also that I have tried various other scripts of the kind and always give me similar errors namely:
: this line does not contain a recognized action
the program will exit.

when I copy the scripts I compile them with ahk2exe
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: frequent errors even in the published lists

25 Jun 2018, 12:56

Replace with "if (GetKeyState, LButton, P)"
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: frequent errors even in the published lists

25 Jun 2018, 13:00

you cant stuff commands into expressions. either adhere to using commands the proper way(id recommend not using them at if you can help it) or use their respective function versions, where applicable.

see: https://autohotkey.com/docs/Language.ht ... -functions

in fact, read the whole page in its entirety
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: frequent errors even in the published lists

25 Jun 2018, 13:17

swagfag wrote:you cant stuff commands into expressions. either adhere to using commands the proper way(id recommend not using them at if you can help it) or use their respective function versions, where applicable.

see: https://autohotkey.com/docs/Language.ht ... -functions

in fact, read the whole page in its entirety
https://autohotkey.com/boards/viewtopic ... 17&t=50921 How did this guy post something with your name? :eh:
gregster
Posts: 8999
Joined: 30 Sep 2013, 06:48

Re: frequent errors even in the published lists

25 Jun 2018, 13:21

Qysh wrote:
swagfag wrote:you cant stuff commands into expressions. either adhere to using commands the proper way(id recommend not using them at if you can help it) or use their respective function versions, where applicable.

see: https://autohotkey.com/docs/Language.ht ... -functions

in fact, read the whole page in its entirety
https://autohotkey.com/boards/viewtopic ... 17&t=50921 How did this guy post something with your name? :eh:
He didn't. The spammer's post (originally above swagfag's post which was only a reaction to the spammer) was deleted.
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: frequent errors even in the published lists

25 Jun 2018, 13:27

gregster wrote:
Qysh wrote:
swagfag wrote:you cant stuff commands into expressions. either adhere to using commands the proper way(id recommend not using them at if you can help it) or use their respective function versions, where applicable.

see: https://autohotkey.com/docs/Language.ht ... -functions

in fact, read the whole page in its entirety
https://autohotkey.com/boards/viewtopic ... 17&t=50921 How did this guy post something with your name? :eh:
He didn't. The spammer's post (originally above swagfag's post which was only a reaction to the spammer) was deleted.
oh ok thanks for the explanation :)
gregster
Posts: 8999
Joined: 30 Sep 2013, 06:48

Re: frequent errors even in the published lists

25 Jun 2018, 13:30

@techila, in the code above, there are also multiple syntax errors regarding spaces: spaces at the wrong places and and missing spaces where they are needed.
I have no idea from where you copied it, but I would recommend to work first through the AHK docs and the included code examples to get the basics down.... before you copy faulty code from other sources.
techila
Posts: 3
Joined: 25 Jun 2018, 05:41

Re: frequent errors even in the published lists

26 Jun 2018, 02:20

thanks for the advice, if 'I can ask you where I can find some material to study the interaction of autohotkey with the access database, and also I find the right and simple information to learn the copy and paste commands to start working with access in simple way, by doing autohotkey to perform the search operations in the database fields, making him compare data.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 343 guests