Jump to content

Learning the Functions


Recommended Posts

1 minute ago, UltraTM said:

and stop it when releasing the button.

That is impossible with normal functions AFAIK. You cannot stop a function once you have started it (You can pause it though, look at the documentation for Adlib function).

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

18 minutes ago, TheDcoder said:

That is impossible with normal functions AFAIK. You cannot stop a function once you have started it (You can pause it though, look at the documentation for Adlib function).

uff

ok and how about for example pressing "Space" until the key will be released?

Only cant get the start how to loop the stuff inside the loop for checking if the key is still pressed or not.

Link to comment
Share on other sites

6 minutes ago, UltraTM said:

ok and how about for example pressing "Space" until the key will be released?

You don't have enough practice with AutoIt, just replace the ConsoleWrite line with Send

Edited by TheDcoder

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

1 minute ago, TheDcoder said:

You don't have enough practice with AutoIt, just replace the ConsoleWrite line with Send

God damnit sorry didnt saw that :D

ok it was really easy damn shame on me.


Another thing.

if i use for example an keyboard letter  a or something he will also make aaaaaaa and space
how can i say a is like a hotkey and it should only send the command instead of this key also.

Link to comment
Share on other sites

1 minute ago, UltraTM said:

if i use for example an keyboard letter  a or something he will also make aaaaaaa and space
how can i say a is like a hotkey and it should only send the command instead of this key also.

Sorry, I can't understand you :unsure:.

 

Anyway, now you know the basic syntax, you can do anything with just a few tweaks. I cannot help you any further regarding Automation because I have never done any automation myself!

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

1 minute ago, TheDcoder said:

Sorry, I can't understand you :unsure:.

 

Anyway, now you know the basic syntax, you can do anything with just a few tweaks. I cannot help you any further regarding Automation because I have never done any automation myself!

Ok what i mean is.

 

instead of the middle mouse button i use the "a" key on the keyboard.

 

This means:

 

i hold "a" then he writes  a     a     a          a    

 

This means he writes also the key i press + the example Space key i want to use.

 

 

Link to comment
Share on other sites

14 minutes ago, TheDcoder said:

You don't have enough practice with AutoIt, just replace the ConsoleWrite line with Send

the program when i run it :D with F5 to test.

mouse buttons works directly.

but other keyboard keys seams to also write something.

 

Link to comment
Share on other sites

1. Open notepad
2. Run this script:

#include <misc.au3>
While 1
    If _IsPressed(41) Then ;41 is Aplphabet A
        While _IsPressed(41) ;41 is Alphabet A
            Send(' ')
        WEnd
    EndIf
    Sleep(10)
WEnd

3. Activate notepad and hold "A"

You will be writing both A and Space at the same time.

AXNfl0i.png

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Just now, TheDcoder said:

1. Open notepad
2. Run this script:

#include <misc.au3>
While 1
    If _IsPressed(41) Then ;41 is Aplphabet A
        While _IsPressed(41) ;41 is Alphabet A
            Send(' ')
        WEnd
    EndIf
    Sleep(10)
WEnd

3. Activate notepad and hold "A"

You will be writing both A and Space at the same time.

AXNfl0i.png

Yes thats what i mean.

 

Now i made a as HotKeySet and say it should run an empty function.

 

here:

#include <Misc.au3>
HotKeySet ("{a}", "_test")

Func _test () ; Funktion _wechseln
EndFunc 

While 1
    If _IsPressed(41) Then ;04 is Middle Click
        While _IsPressed(41) ;04 is Middle Click
                    Send ("{Space}")
        WEnd
    EndIf
    Sleep(10)
WEnd

Looks good now.
Dont know if this is a great solution ^^

I also wanted to know how can i add 2 keys.

For example with a he should write space
he does now
and with  b he write x for example

 

Means this function 2 times.

Im really trying to learn the stuff but its not so easy for me sorry for that :D

Link to comment
Share on other sites

2 minutes ago, UltraTM said:

Means this function 2 times.

Nope, its not possible, multi-threading is impossible in AutoIt.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

10 minutes ago, TheDcoder said:

Nope, its not possible, multi-threading is impossible in AutoIt.

SO theres no chance to make an ElseIf or something.

So i could say if a is pressed then send space
ElseIf b is pressed send x.

 

Not both together

Link to comment
Share on other sites

4 minutes ago, TheDcoder said:

Yes, 2 functions cannot run in parallel.

ok
but i mean function with key "a"
or

function with key "b"

in one script


this is not possible? oO
 

both a the same time makes sence for me.

Link to comment
Share on other sites

3 minutes ago, UltraTM said:

but i mean function with key "a"
or

function with key "b"

I know that its possible, but I don't know how :(.

 

As I have already said, I don't have any experience with Automation.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

2 minutes ago, TheDcoder said:

I know that its possible, but I don't know how :(.

 

As I have already said, I don't have any experience with Automation.

Ah ok.

maybe someone else could help out here :)


But thank you very much for the help. Now i know allready something more.
Mostly i think to complicated. Was easy to solve the first thing :D
thx to you for it :)

Link to comment
Share on other sites

Looks like i got it with some tricks for testing hehe :)

 

#include <Misc.au3>
HotKeySet ("{a}", "_test")
HotKeySet ("{b}", "_test2")

Func _test () 
EndFunc 

Func _test2 () 
EndFunc 

While 1
    If _IsPressed(41) Then 
        While _IsPressed(41)
                    Send ("{Space}")
        WEnd
    EndIf
    If _IsPressed(42) Then 
        While _IsPressed(42) 
                    Send ("{x}")
        WEnd
    EndIf
    Sleep(10)
WEnd

Yihaaa.

 

Only thing is im not sure about my HotKeySet trick to prevent it from being also showed in the text editor.

Maybe theres a function inside for this :)   

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