Very new and want to write a script but don't know how...
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Very new and want to write a script but don't know how...
Hello, so i am very new to autohotkey. I also do not know much about scripts or any programing... I would like to create a script that types a word for instance " testing" and sends in x amount of time lets say like 20 times. Can someone help me with this...
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
The only thing i am not seeing anywhere is anything about looping...? i think those are the only other things i need.
Last edited by matthewd253 on 30 Dec 2018, 15:13, edited 1 time in total.
Re: Very new and want to write a script but don't know how...
matthewd253 wrote: ↑30 Dec 2018, 15:07The only thing i am not seeing anywhere is the symbol for enter, and anything about looping...? i think those are the only other things i need.
Send says:
From the tutorial - section 3:Key Names: The following table lists the special keys that can be sent (each key name must be enclosed in braces):
[...]
{Enter} Enter key on the main keyboard
The gigantic table on the Send page shows pretty much every special key built-in to AHK. For example: {Enter} and {Space}.
Last edited by gregster on 30 Dec 2018, 15:16, edited 1 time in total.
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
thank you, i just found the enter thing now im looking through loop. thank you!
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
Okay so i am very confused with the whole loop thing....
Loop, 3
{^x::
Send, testing one {Enter}
}
return
This is what i have..... the loop wont work and i don't know what i did wrong...
Loop, 3
{^x::
Send, testing one {Enter}
}
return
This is what i have..... the loop wont work and i don't know what i did wrong...
Re: Very new and want to write a script but don't know how...
I assume you want to do this:
The key combo has to go to the top of a hotkey definition.
Code: Select all
^x:: ; Ctrl + x
Loop, 3
{
Send, testing one {Enter}
}
return
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
Yes!!! thank you, i just ran into a slight issue with it though.... it types to quickly so it sends it as
testing one
esting one
ting one.
how could i fix this?
testing one
esting one
ting one.
how could i fix this?
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
Okay that worked, with the loop being three it only sent it twice. so i changed it to 10 and it sent it 6 times with it only messing the word up once. so getting very close here lol. what could be causing this issue??
Re: Very new and want to write a script but don't know how...
That's weird... where are you posting it?
Perhaps add a sleep between the lines...
Perhaps add a sleep between the lines...
Code: Select all
^x:: ; Ctrl + x
Loop, 10
{
SendInput, testing one {Enter}
sleep 50 ; sleep 50 ms
}
return
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
I posting it in a message on facebook. and okay ill try that.
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
well i added the sleep but now it sent 7 times with two of them being 1 letter..
getting closer but also farther away.
getting closer but also farther away.
Re: Very new and want to write a script but don't know how...
I don't use Facebook, I cannot check... perhaps some javascript is messing up the edit field on the website.
Someone else might chime in.
Someone else might chime in.
-
- Posts: 9
- Joined: 30 Dec 2018, 13:23
Re: Very new and want to write a script but don't know how...
hope so, i would like to figure this out.
Re: Very new and want to write a script but don't know how...
you may need to define where this code will send the text to:
For example if it is a notepad, it goes like this:
If it is in a specific location in a web browser, e.g. google chrome, then:
https://autohotkey.com/docs/commands/WinActivate.htm
https://autohotkey.com/docs/commands/MouseClick.htm
For example if it is a notepad, it goes like this:
Code: Select all
^x:: ; Ctrl + x
Loop, 10
{
winactivate ahk_exe notepad.exe ;assuming you are sending this code to notepad.
SendInput, testing one {Enter}
sleep 100 ; sleep 50 ms
}
return
Code: Select all
^x:: ; Ctrl + x
Loop, 10
{
winactivate ahk_exe chrome.exe ;assuming you are sending this code to chrome.
MouseClick, left, 250, 300 ;sending left-click on x,y co-ordinates in the browser.
SendInput, testing one {Enter}
sleep 100 ; sleep 50 ms
}
return
https://autohotkey.com/docs/commands/MouseClick.htm
Who is online
Users browsing this forum: pgeugene, Sean24, SmithyZoomZoom and 174 guests