Sign in to follow this  
Followers 0
mick200

Send url/adress script with Hotkeys.

6 posts in this topic

Hello Everybody,

I am having troubles with building a script that could be very handy for my daily work.

I want it to do the following things:

When i press "RCTRL+1" i want it to SEND the url "C:\FOLDER1" and then hit ENTER.

And when i press "RCTRL+2" i want it to SEND the url "C:\FOLDER2" and then hit ENTER.

Could someone help me with building this script ? I'm new to AutoIt.

PS. Is it also possible to let the script run in the background the whole day, so i can use the hotkeys whenever i need them?

Thanks in advance,

Mick

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Check out _IsPressed and HotKeySet

Edited by ZacUSNYR

Share this post


Link to post
Share on other sites

I tried _IsPressed but i can only use the Hotkey once then the script quits.

Share this post


Link to post
Share on other sites

It needs to be in a loop - i'd make it call a function.

From the Example I assume you tried.

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

If you look at the example and try to understand it, it's starting the loop, taking a 250ms pause, then waiting for a key press. If the key press matches then it'll give you pop up msgbox and then it'll exit the loop, therefore it'll only run once.

Removing the ExitLoop will keep it in the loop.

Share this post


Link to post
Share on other sites

This works thanks, now how do i add an extra line, this doesn't work.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep ( 250 )

If _IsPressed("A1"+"61", $dll) Then

MsgBox(0,"_IsPressed", "End Key Pressed")

If _IsPressed("A1"+"62", $dll) Then

MsgBox(0,"_IsPressed", "Other Key Pressed")

EndIf

WEnd

DllClose($dll)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
 Sleep ( 250 )
  If _IsPressed("A1"+"61", $dll) Then
    MsgBox(0,"_IsPressed", "End Key Pressed")
  ElseIf _IsPressed("A1"+"62", $dll) Then  ;You're doing a second If statement, try doing an ElseIf ;)  
    MsgBox(0,"_IsPressed", "Other Key Pressed")
  EndIf
WEnd
DllClose($dll)

Edit : Just looked at what you're doing, perhaps this is a lil bit cleaner? Don't check the other presses if Right Shift isn't held down.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
 Sleep ( 250 )
  If _IsPressed("A1", $dll) Then
    If _IsPressed("61", $dll) Then MsgBox(0,"_IsPressed", "1")
    If _IsPressed("62", $dll) Then MsgBox(0,"_IsPressed", "2")
  EndIf
WEnd
DllClose($dll)
Edited by ZacUSNYR

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