when i use command like this :
^s
click
return
this command not start automaticaly ,
and i should press ctrl + s key to start it
i tested this command to start automaticaly without press ( ctrl + s )
^s
run{click}
return
but i cannot get answer
how to send keys when start ahk file
Re: how to send keys when start ahk file
What is it that you want exactly? you want it to click just as you open the ahk file?
If so, you could do:
That way it runs just when you start it and then you can re-run with ctrl+s.
The "Sleep, 100" is just to give it some time, but can be removed.
And just in case you could add #persistent just at the beginning of the script to keep it from closing.
If so, you could do:
Code: Select all
Sleep, 100
click
^s
click
return
The "Sleep, 100" is just to give it some time, but can be removed.
And just in case you could add #persistent just at the beginning of the script to keep it from closing.
Re: how to send keys when start ahk file
cose should like this ?elModo7 wrote:What is it that you want exactly? you want it to click just as you open the ahk file?
If so, you could do:That way it runs just when you start it and then you can re-run with ctrl+s.Code: Select all
Sleep, 100 click ^s click return
The "Sleep, 100" is just to give it some time, but can be removed.
And just in case you could add #persistent just at the beginning of the script to keep it from closing.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Sleep, 100
click
^s
click
return
Re: how to send keys when start ahk file
That's right, but it's not all that necessary, just my "raw code" should do the job too.
Re: how to send keys when start ahk file
thanks aheadelModo7 wrote:That's right, but it's not all that necessary, just my "raw code" should do the job too.
my last question is :
when i copy exmaple.ahk file in folder , this code cannot click on icon in Desktop
( my mean is : this click cannot go outside of folder window size )
when i use code like this
click
^s
click 10, 225, 2
return
-------------------------------------------
this code cannot go outside of folder window size
how can i resolve this problem ?
Re: how to send keys when start ahk file
Try this:
Change coordinates to your liking.
Code: Select all
MouseClick, left, 572, 361
Re: how to send keys when start ahk file
this code had behavior like previous codeelModo7 wrote:Try this:Change coordinates to your liking.Code: Select all
MouseClick, left, 572, 361
---------------------------
Click
^s
MouseClick, left, 10, 225, 2
return
Re: how to send keys when start ahk file
AH! so you want to store your *.AHK file inside a folder, then have it go to the desktop and do click that folder/file right?
Then this is the complete code:
Then this is the complete code:
Code: Select all
WinWait, , FolderView
IfWinNotActive, , FolderView, WinActivate, , FolderView
WinWaitActive, , FolderView
Send, {LWINDOWN}d{LWINUP}
MouseClick, left, 741, 375
Sleep, 100
Re: how to send keys when start ahk file
thank youelModo7 wrote:AH! so you want to store your *.AHK file inside a folder, then have it go to the desktop and do click that folder/file right?
Then this is the complete code:Code: Select all
WinWait, , FolderView IfWinNotActive, , FolderView, WinActivate, , FolderView WinWaitActive, , FolderView Send, {LWINDOWN}d{LWINUP} MouseClick, left, 741, 375 Sleep, 100
this problem resolved too ,
if i had opened website in browser ( like ie or mozilla or chrome ) and if i want to click on link within website in for example position 10 , 200
what can i do ?
( i tested this code and this code can click only within desktop and cannot click in everything else like browser )
Re: how to send keys when start ahk file
Then you can use the initial one I gave you xD.fun_9990 wrote:thank youelModo7 wrote:AH! so you want to store your *.AHK file inside a folder, then have it go to the desktop and do click that folder/file right?
Then this is the complete code:Code: Select all
WinWait, , FolderView IfWinNotActive, , FolderView, WinActivate, , FolderView WinWaitActive, , FolderView Send, {LWINDOWN}d{LWINUP} MouseClick, left, 741, 375 Sleep, 100
this problem resolved too ,
if i had opened website in browser ( like ie or mozilla or chrome ) and if i want to click on link within website in for example position 10 , 200
what can i do ?
( i tested this code and this code can click only within desktop and cannot click in everything else like browser )
Re: how to send keys when start ahk file
elmodo7 , i am so sorryelModo7 wrote:...
this code is not working in browser
because cannot go outside of the folder window box
Code: Select all
Click
^s
MouseClick, left, 10, 225, 2
return
Re: how to send keys when start ahk file
i test it again
about use in browser
this command worked when it is in desktop but not work in folder
about use in browser
this command worked when it is in desktop but not work in folder
Re: how to send keys when start ahk file
You asked about clicking outside of the folder(Desktop)fun_9990 wrote:i test it again
about use in browser
this command worked when it is in desktop but not work in folder
Lol my bad there you actually can, just use the same code with different window tittle, make it match yours:
Code: Select all
WinWait, Wikipedia`, la enciclopedia libre - Google Chrome, Chrome Legacy Window
IfWinNotActive, Wikipedia`, la enciclopedia libre - Google Chrome, Chrome Legacy Window, WinActivate, Wikipedia`, la enciclopedia libre - Google Chrome, Chrome Legacy Window
WinWaitActive, Wikipedia`, la enciclopedia libre - Google Chrome, Chrome Legacy Window
MouseClick, left, 741, 375
Sleep, 100
If you want to go to that website without it being already open, just use
Code: Select all
Run, http://yourweb.crap
Re: how to send keys when start ahk file
i think this code is not rightelModo7 wrote:You asked about clicking outside of...fun_9990 wrote:i test it again
about use in browser
this command worked when it is in desktop but not work in folder
because when i open any website and try to click in sample position within it , this code has not any acitivity about open link
Re: how to send keys when start ahk file
I don't know exactly what you want to do, you first say something, then you want something slightly different xD.
Please explain it better.
Please explain it better.
Re: how to send keys when start ahk file
when i use command like this :
^s
click
return
Code: Select all
^s
Re: how to send keys when start ahk file
I Could be wrong here, but it looks like you are trying to make a hotkey to send a click, or w/e
It also looks like you want the coords for your clicks to be related to your screen and not just the active window.
Your script is auto executed and that is why when you have been running it (from the file explorer) it has been sending the clicks to the file explorer and not some other app.
First you might want to set the coordmode at the top of the script (you may or may not want to do this.)
Here is how you set your coords to be related to the screen
Next it looks like what you want to do is use ^s as a hotkey
Here is how you make that.
I hope this is what you were looking for.
It also looks like you want the coords for your clicks to be related to your screen and not just the active window.
Your script is auto executed and that is why when you have been running it (from the file explorer) it has been sending the clicks to the file explorer and not some other app.
First you might want to set the coordmode at the top of the script (you may or may not want to do this.)
Here is how you set your coords to be related to the screen
Code: Select all
CoordMode,Mouse,Screen
Here is how you make that.
Code: Select all
^s:: ;the two colons are needed to make it a hotkey
Click, x y
return