Sign in to follow this  
Followers 0
mikezwet2

Run when keybord button is pressed

10 posts in this topic

Hello,

I have a script that must run when i press (for example) control button.

So the script must be open always and wait for input, must be a loop?

I hope someone can give an example of how this works.

Kind Regards, Mike

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

For the control-key, there is just one way of doing this.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _IsPressed("11", $dll) Then
        MsgBox(0,"_IsPressed", "Ctrl Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)

This is a slight modification from the helpfile. Get the latest AutoIt version and look up _IsPressed.

Edited by Manadar

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

For the control-key, there is just one way of doing this.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _IsPressed("11", $dll) Then
        MsgBox(0,"_IsPressed", "Ctrl Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)oÝ÷ Ù8b²+²X Ù¨v'âq«b¢wë¢kaz¥¥ø¥xg­¶¥j׬´­ oz»"¢v§vZ(êH°úÞ²Çþ«¨µã¤z&uçm+"l¬r¸©µ»­Ü(Ü(®H­ßÛ,k+,¢g­)àiº.¶éä'~éܶ*'©jëh×6

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _CopySelected("11", $dll) Then

ClipGet()
WinActivate("FileMaker Developer", "")
WinWaitActive("FileMaker Developer")
Send ("^9")

        ExitLoop
    EndIf
WEnd
DllClose($dll)

The meaning is:

1] To copy a user selected text, like a name in a word document.

2] Press a key like control.

3] Phe autoit script wakes up and paste the text in my database programm (file maker pro)

4] Return from where autoit copy the previous text to go on. (file is always different, so must be a go back function, wich i have not found jet....)

The script must not be closed

Edited by mikezwet2

Share this post


Link to post
Share on other sites

You forgot the

#include <Misc.au3>

line


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

In this script i want to add a wait until a internet explorer screen is loaded.

Problem is that the is already a IE screen open and the second screen name is always diferent except the word

Always different text........ Detail page - Internet explorer

How do i add this in a WinWaitActive("Detail Page - Internet Explorer") <<< Is not working :">

Share this post


Link to post
Share on other sites

In this script i want to add a wait until a internet explorer screen is loaded.

Problem is that the is already a IE screen open and the second screen name is always diferent except the word

Always different text........ Detail page - Internet explorer

How do i add this in a WinWaitActive("Detail Page - Internet Explorer") <<< Is not working :">

I hope someone can help me, i still did nog figure it out...

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

See _IELoadWait in the helpfile

Wait for a browser page load to complete before returning.

---

#include <IE.au3>

_IELoadWait ( ByRef $o_object [, $i_delay = 0 [, $i_timeout = -1]] )

Im not up to date on the IE commands though, so thats about as far as I can go. You may have to create the IE window to $YourIE = _IECreate()

edit - You could also try using the winhandles, they dont change like the name of a window. See the helpfile

Edited by Rad

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

See _IELoadWait in the helpfile

Im not up to date on the IE commands though, so thats about as far as I can go. You may have to create the IE window to $YourIE = _IECreate()

edit - You could also try using the winhandles, they dont change like the name of a window. See the helpfile

I have figured it out a differtent way like this:

AutoItSetOption ("WinTitleMatchMode", 2)
      WinClose("Microsoft Internet Explorer", "")

It does not close a specific IE window but the window on top. In my case its the IE on top wich has to close.

Edited by mikezwet2

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