 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
padarrju
Joined: 23 Jan 2006 Posts: 37 Location: Vadodara - Gujarat (INDIA)
|
Posted: Thu Aug 24, 2006 10:49 am Post subject: How to find the window title name last but one ... |
|
|
Hello Friends,
I have a small problem. I know how to find last activated window. But I need to know last but one activated window title.
For an Example :
--------------------
Step : 1 I opened Excel application, so my active window title would be 'Microsoft Excel - Book1'
2 Now I click 'File --> Print', so my active window title would be 'Print'.
My objective is to find : last_but_one_window := 'Microsoft Excel - Book1'.
I need to close the 'Print' window if it is activated from Excel application only & not in case my 'Print' window is activated from any other application.
How do I do it ?
Thanks well in Advance !
Kind Regards,
Raju C Padaria |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Aug 24, 2006 11:03 am Post subject: |
|
|
| Code: | SetTimer, PrevWin, 500
Return
PrevWin:
WinGetActiveStats, Title, Width, Height, X, Y
If Title = %PrevTitle%
Return
PrevTitle := Title
Return
!y::ToolTip %PrevTitle | Might be nonsense ... |
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Thu Aug 24, 2006 11:09 am Post subject: |
|
|
In Excel you are able to define a button / menu entry / shortcut to print to the default printer, without the dialog box. This will start printing immediately. It that is what you want. _________________ Is there another word for synonym? |
|
| Back to top |
|
 |
padarrju
Joined: 23 Jan 2006 Posts: 37 Location: Vadodara - Gujarat (INDIA)
|
Posted: Thu Aug 24, 2006 11:13 am Post subject: |
|
|
| SanskritFritz wrote: | | In Excel you are able to define a button / menu entry / shortcut to print to the default printer, without the dialog box. This will start printing immediately. It that is what you want. |
No, When I open, Excel & then try to print the worksheet, my script should stop me with a message 'This function is disabled ...'. But if I open any other application, say, MS word & then try to print the document, it should allow me to print.
Thanks !
Best Regards,
Raju C Padaria |
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Thu Aug 24, 2006 11:15 am Post subject: |
|
|
Another idea: the parent window of Excel's Print dialog is Excel itself. So my question is: how to find out the parent of a dialog window? A Dll call perhaps? _________________ Is there another word for synonym? |
|
| Back to top |
|
 |
BoBo Guest
|
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Aug 24, 2006 11:26 am Post subject: |
|
|
Looks like I've hit the 70.000 post with my previous one  |
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Thu Aug 24, 2006 11:31 am Post subject: |
|
|
Found it: hw_parent := DllCall( "GetParent", "uint", hw_active )
So, get the hwnd of the active Print dialog, get the hwnd of the parent and if it is excel (WinGetClass), close the dialog. Let us know if this works, I'm not sure if GetParent can be used this way. _________________ Is there another word for synonym? |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Aug 24, 2006 12:18 pm Post subject: |
|
|
| BoBo wrote: | Looks like I've hit the 70.000 post with my previous one  | How do you know this? _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Fri Aug 25, 2006 7:54 am Post subject: |
|
|
padarrju, people are trying to help here in the forum. If you dont give any feedback (and checking your posts, lately your are prone to do that), soon you will not get any help. We feed our ego on positive (or negative) reactions . Just a quick "thanks it worked, here is my code", or "that didnt help at all, can you give me other advices?" would suffice, just for us to see that we did not try to help in vain  _________________ Is there another word for synonym? |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Fri Aug 25, 2006 8:40 am Post subject: |
|
|
| SanskritFritz wrote: | [We feed our ego on positive (or negative) reactions  | Well put...
Well, sometime people take time to answer, being busy, absent, in holidays...
I see no answers as "it worked", otherwise we would have another question...
@Goyyah: you understood BoBo better than me, I naively thought that he posted 70,000 messages... Indeed, it was stupid.
Note: I suppose that ImageShack images won't be kept eternally, so for the curious, I reproduce the relevant line: Our users have posted a total of 70000 articles from the "Who is Online" box of the forum home page. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
padarrju
Joined: 23 Jan 2006 Posts: 37 Location: Vadodara - Gujarat (INDIA)
|
Posted: Sat Aug 26, 2006 5:40 am Post subject: |
|
|
| SanskritFritz wrote: | padarrju, people are trying to help here in the forum. If you dont give any feedback (and checking your posts, lately your are prone to do that), soon you will not get any help. We feed our ego on positive (or negative) reactions . Just a quick "thanks it worked, here is my code", or "that didnt help at all, can you give me other advices?" would suffice, just for us to see that we did not try to help in vain  |
You are right but sometime people take time to answer, being busy, absent, on leaves, etc. as one of our friends (Mr. PhilHo) has already point out it. Sorry for not replying early. I will take care in future.
Hoever, till the time I was working on my requirement & I have found out the solution with your valuable support, I never forget. The program code is given below : (May be helpful to any one of us for such requirement).
| Code: | #SingleInstance ignore
#NoTrayIcon
Loop
{
ifwinactive, Print
{
IfWinExist, gp_frq: Previewer
{
WinKill, Print
BlockInput,On
; msgbox,4096, , This function is disabled ...`n`nPlease Close the report of`nLeave / Muster / GatePass / Comp. Off`nfirst & then Proceed ...,5
SplashTextOn, 300,150, Printing Disabled,This function is disabled`n`nPlease Close the report of`nLeave / Muster / GatePass / Comp. Off`nfirst && then Proceed ...
Sleep,5000
SplashTextOff
Sleep,1000
BlockInput, Off
IfWinNotActive, gp_frq: Previewer
{
WinActivate, gp_frq: Previewer
sleep,500
}
else
{
sleep, 500
}
}
}
ifwinactive, Save
{
IfWinExist, gp_frq: Previewer
{
WinKill, Save
BlockInput,On
; msgbox,4096, , This function is disabled ...`n`nPlease Close the report of`nLeave / Muster / GatePass / Comp. Off`nfirst & then Proceed ...,5
SplashTextOn, 300,150, Printing Disabled,This function is disabled ...`n`nPlease Close the report of`nLeave / Muster / GatePass / Comp. Off`nfirst && then Proceed ...
Sleep,5000
SplashTextOff
Sleep,1000
BlockInput, Off
IfWinNotActive, gp_frq: Previewer
{
WinActivate, gp_frq: Previewer
sleep,500
}
else
{
sleep, 500
}
}
}
}
| [Moderator's note: added code section around the script for better readability (indentation).]
Thanks a lot !
Best Regards,
Raju C Padaria |
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Mon Aug 28, 2006 7:58 am Post subject: |
|
|
ohhhh, now my ego is well fed
even tho i dont see any of my advices in your code, hehe _________________ Is there another word for synonym? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|