Jump to content

Recommended Posts

Posted

I am very new to programming so I have to apoligize ahead of time for asking this simple question. I am trying to write a program that will let me fill out job applications quickly so I am assigning different letters on the keyboard to stand for my name or address...etc. So far I have written this

HotKeySet("{J}", "Jeremy")

Func Jeremy()

HotKeySet("{J}")

Send("{Jeremy}")

HotKeySet("{J}", "Jeremy")

EndFunc

As you can see I am trying to assign the letter J as a hotkey that will call a function that will type my name. However when I run this program nothing happens. I think it is becuase I need a loop that will keep the program running but I am not sure. Any help would be greatly appreciated.

  • Moderators
Posted

You were close:

HotKeySet('j', 'Jeremy')
While 1
    Sleep(10000);lets keep the script running, should make a hot key to exit though
WEnd
Func Jeremy()
    HotKeySet('j')
    Send('Jeremy')
    HotKeySet('j', 'Jeremy')
EndFunc

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.

Posted

Thank you for the help Smoke N. Unfortunately I ran into a new problem. I followed the same format for some other functions as shown below...

HotKeySet('j', 'Jeremy')

HotKeySet('h', 'Herman')

HotKeySet('a', 'address')

While 1

Sleep(10000);lets keep the script running, should make a hot key to exit though

WEnd

Func Jeremy()

HotKeySet('j')

Send('Jeremy')

HotKeySet('j', 'Jeremy')

EndFunc

Func Herman()

HotKeySet('h')

Send('Herman')

HotKeySet('h', 'Herman')

EndFunc

Func Address()

HotKeySet('a')

Send('2402 Mahogany Glen Place')

HotKeySet('a', 'address')

EndFunc

When I type the letter j it returns jeremy but when I try to use the hotkeys for the other functions, it sends my address and last name together. This doesn't make any sense at all to me. Its like it wants to combine the two functions. If someone helps me with this problem I will be very appreciative.

Posted (edited)

Now for the solution.. When you write Herman you use an a... the a tricker the adress hotkey :)

HotKeySet('j', 'Jeremy')
HotKeySet('h', 'Herman')
HotKeySet('a', 'Address')
While 1
    Sleep(10000);lets keep the script running, should make a hot key to exit though
WEnd

Func _EnableHot()
    HotKeySet('j', 'Jeremy')
    HotKeySet('h', 'Herman')
    HotKeySet('a', 'Address')
EndFunc

Func _DisableHot()
    HotKeySet('j')
    HotKeySet('h')
    HotKeySet('a')
EndFunc

Func Jeremy()
    _DisableHot()
    Send('Jeremy')
    _EnableHot()
EndFunc

Func Herman()
    _DisableHot()
    Send('Herman')
    _EnableHot()
EndFunc

Func Address()
    _DisableHot()
    Send('2402 Mahogany Glen Place')
    _EnableHot()
EndFunc

See pretty with autoit tags :whistle:

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...