Hey guys,
I just started using AH and I LOVE IT. Saves me a lot of time doing mindless tasks.
I only have one question at this moment, is there a way to run a specific scrip linked to a specific program that is minimized/in the background so I can do other things in the system?
Thanks a lot..
[solved] - Run a script for a program in the background?
Started by
Sontawila
, Sep 28 2011 08:31 AM
12 replies to this topic
#1
-
Posted 28 September 2011 - 08:31 AM
Welcome!
Heres a small example
- Run ( HIDE )
- ahk_pid + ahk_id
- ControlSetText and all other control commands.
- Expressions
- Also learn how to use AU3spy.exe that comes with AHK ( run below code )
Heres a small example
detectHiddenWindows, on run notepad,, hide, npPid winWait % "ahk_pid " npPid controlSetText, edit1, Some text, % "ahk_pid " npPid msgbox 'Some Text' was written to notepad in background.`nPress OK to show. winShow, % "ahk_pid " npPidThe things to look into:- DetectHiddenWindows
- Run ( HIDE )
- ahk_pid + ahk_id
- ControlSetText and all other control commands.
- Expressions
- Also learn how to use AU3spy.exe that comes with AHK ( run below code )
run % A_ProgramFiles "\AutoHotkey\AU3_Spy.exe"hth
#2
-
Posted 28 September 2011 - 09:44 AM
don't duplicate, iterate!
Thank you very much for the replies. Unfortunately I have very little programming experience so this is a challenge for me
What I want to do is: launch the application, start AHK to let it do its thing and then I minimize the application/alt-tab to desktop, browser, other application...etc and have AHK work in the background without affecting me.
my simple code is as follow:
What I want to do is: launch the application, start AHK to let it do its thing and then I minimize the application/alt-tab to desktop, browser, other application...etc and have AHK work in the background without affecting me.
my simple code is as follow:
#z::pause; Press Win+z to pause. Press again to resume #s:: Loop { Send {Enter} Sleep 2000 Send {Enter} Sleep 2000 Send {Enter} Sleep 4000 Send {Enter} Sleep 4000 Send {Esc} Sleep 4000 Send {Down} Sleep 1500 } returnThanks again
#4
-
Posted 28 September 2011 - 11:13 AM
Try this:
F6:: WinGet, programid,List, program name <------ programid = "program name"+id at the end Loop { ControlSend,,{Enter}, ahk_id %programid1% <------ programid = "program name"+id1 at the end Sleep 2000 ControlSend,,{Enter}, ahk_id %programid1% Sleep 2000 ControlSend,,{Enter}, ahk_id %programid1% Sleep 4000 ControlSend,,{Enter}, ahk_id %programid1% Sleep 4000 ControlSend,,{Esc}, ahk_id %programid1% Sleep 4000 ControlSend,,{Down}, ahk_id %programid1% Sleep 1500 } F2::pause
#5
-
Posted 28 September 2011 - 11:42 AM
Thank you para for the reply again.
Can I trouble you again by explaining the code for me a bit? :oops:
And what should I put as program name? the name.exe?
Can I trouble you again by explaining the code for me a bit? :oops:
And what should I put as program name? the name.exe?
#6
-
Posted 28 September 2011 - 10:32 PM
program name in the WinGet command should be replaced with the Title of the target window. Also be sure to look at SetTitleMatchMode
#7
-
Posted 28 September 2011 - 10:50 PM
and what is ID?
My program win name is: Net Cafe and has more than 1 window.
My program win name is: Net Cafe and has more than 1 window.
#8
-
Posted 29 September 2011 - 01:10 AM
the WinGet command will get a list of all ids of all the windows that match the title given, then the "ahk_id %programid1%" specifies that all the keys are sent to the first window in the list of windows found.
#9
-
Posted 29 September 2011 - 02:07 AM
Ok, what happens when two windows with the same name exist? or when a new window of the same name is created?
#10
-
Posted 29 September 2011 - 02:42 AM
Thanks guys, I tried the code and it worked perfectly
THANK YOU!!
THANK YOU!!
#11
-
Posted 29 September 2011 - 08:12 PM
Thanks guys, I tried the code and it worked perfectly
THANK YOU!!
do you mind posting a copy of your working code...like you im a beginner with this and has a very litle of programming
#12
-
Posted 30 September 2011 - 05:46 AM
Your welcome. I have 2 week on AHK but i try to help people whit simple scripts i can make.
#13
-
Posted 30 September 2011 - 09:01 AM