AutoHotkey Community

It is currently May 26th, 2012, 1:38 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: October 15th, 2007, 2:19 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
Works on my XP SP2 UK English, Although I did have a strange occurance of having 32772 instead of 17 for hshell_rudeactivated or whatever it is.

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2007, 5:17 pm 
Offline

Joined: December 6th, 2007, 5:42 am
Posts: 21
Location: chennai
using code of experiment 1, how can i check whether a site is accessed thru the browser and run a set of commands based on it....
like filling the id and password ,etc....

i tried putting the name of the website in the "title" field, but it didnt work,...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2007, 5:20 pm 
Offline

Joined: December 6th, 2007, 5:42 am
Posts: 21
Location: chennai
this is the code i was talking abt ,

Code:
#Persistent
SetBatchLines, -1
Process, Priority,, High

Gui +LastFound
hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return

ShellMessage( wParam,lParam ) {
  If ( wParam = 1 ) ;  HSHELL_WINDOWCREATED := 1
     {
       WinGetTitle, Title, ahk_id %lParam%
       If  ( Title = "Windows Task Manager" )
         {
           WinClose, ahk_id %lParam%
         ; Run, Calc.exe              ; instead
         }
     }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2007, 5:39 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
0inprogram wrote:
i tried putting the name of the website in the "title" field, but it didnt work,...


This SHELLHOOK method will at most can alert you when a IEFrame ( or mozilla or opera ) becomes active.

You have to check the titlebar / address bar if want to conditionally execute code.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2007, 9:37 am 
Offline

Joined: December 6th, 2007, 5:42 am
Posts: 21
Location: chennai
how can i get the titlebar and conditionaly execute code, in tht same script


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2007, 5:59 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
0inprogram wrote:
how can i get the titlebar and conditionaly execute code, in tht same script


Code:
Gui +LastFound
hWnd := WinExist()

DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )

Return ;                                                 // End of Auto-Execute Section //

ShellMessage( wParam,lParam ) {
if ( wParam = 4 or wParam = 1 ) ; HSHELL_WINDOWACTIVATED / CREATED
  {
    WinGetClass, Class, ahk_id %lParam%
    If Class in IEFrame,MozillaWindowClass,OpWindow
         SetTimer, CheckWinTitle, 100
    Else SetTimer, CheckWinTitle, OFF           
  }
}

CheckWinTitle:
   WinGetTitle, Title, A
   If InStr( Title, "youtube" )
   or InStr( Title, "orkut" )
   or InStr( Title, "autoit" ) ;)
      WinClose, A
Return   


Somebody wrote a stupid prank with autohotkey, the above imitates it.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2007, 8:16 am 
Offline

Joined: December 6th, 2007, 5:42 am
Posts: 21
Location: chennai
it works fine with IE, but doesnt respond with firefox


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2007, 8:24 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
0inprogram wrote:
doesnt respond with firefox


I have used the wrong window class.
It should have been MozillaUIWindowClass.

Also, I do not know the correct class name for opera.
I retrieved both of them from our forum's search.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 25th, 2007, 6:35 am 
Offline

Joined: December 6th, 2007, 5:42 am
Posts: 21
Location: chennai
thank u ........ :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2008, 2:36 pm 
Offline

Joined: February 12th, 2008, 2:25 pm
Posts: 13
Location: Munich, Germany
Hi there -

I was experimenting with Skan's Example Nr. 5 as I wanted to do a script that - every time a window is maximized - maximizes the window to a certain size only.

Unfortunately I've got the same problems as shader (XP Prof. SP2, German version, one monitor only).

Took me some time to understand the script, but even now I can't get the HSHELL_GETMINRECT message:
I monitored the parameters

OnMessage( MsgNum, "ShellMessage" )

with

ShellMessages (Msg,hWnd,wParam,lParam)
Msgbox...
(I think the last two parameters only state what kind of message it is...)

While Msg monitors the creating and destroying etc. of any window correctly, max- and minimizing doesn't trigger the OnMessage with me.
(tried Skan's Example Nr. 4 - in this script, these actions don't show up, too)
Anyone got an idea why?

Thanks for your help! :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 10:00 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
thewer wrote:
Took me some time to understand the script, but even now I can't get the HSHELL_GETMINRECT message:


HSHELL_GETMINRECT used to show up in my ShellSpy in Win98, 2K and XP, but it did not when I checked now. :shock:

I was late to suspect my nVidia display in which I had enabled fast minimize / maximize. It had been injecting a DLL proc into every window and was monitoring HSHELL_GETMINRECT !

My code works only if I disable it :(

I even tried SetWindowsHookEx to inject a Dll proc, but in vain.
My best guess is that nVidia is is not using CallNextHookEx, so no other app can receive that particular Shell notification.

Sorry for the delay in reply as it took me time for research.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2008, 2:52 pm 
Offline

Joined: February 12th, 2008, 2:25 pm
Posts: 13
Location: Munich, Germany
Hi -
thanks for your reply! :)

Yes, I've got an Nvidia card as well - disabled the fast min-/maximize and now it at least shows the HSHELL_GETMINRECT, every time I minimize a window, not on maximize or restore...
It really seems to be an interaction with the Nvidia Desktop Manager (I don't have a clue how you found out this one... :o ), interesting thing is, that you can't really disable the wretched thing (I had it disabled actually, still the fast minimize was set).

What I also did: After disabling the fast minimize, I switched off the "menu blending in" effects in the Windows desktop settings, so minimizing windows was fast again - Now the GETMINRECT doesn't show up anymore, too, but on minimizing a window the window is destroyed...

And - suddenly the HSHELL_WINDOWACTIVATED seems to have the code "32772" instead of "4"...

Maybe I should give up coding... :shock:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2008, 3:34 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Code:
I don't have a clue how you found out this one... :o


It used to work flawlessly before I upgraded the display, and hence it should have been obvious. :)

BTW, may I know what you are exactly upto.
There is a ahkhook.dll by JGR with which we can monitor window activities.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2008, 11:48 am 
Offline

Joined: February 12th, 2008, 2:25 pm
Posts: 13
Location: Munich, Germany
Hi -

what I'm trying to do is very similar to your example nr. 5, but maybe it's better to go into detail:

I normally use AveDesk for creating desklets/widgets and recently discovered the power of AHK, which can be nicely integrated.

So I got a kind of system information bar made with AveDesk on top of my screen (Landvermesser did similar stuff with AHK I think) and I don't want maximized windows to overlap it or vize versa the bar overlapping the window/ the window buttons.

Now I'm trying to create a script, that amongst others - every time a window is maximized - maximizes it to a certain size only (leaving a free space for the bar).

I thought the Shell hook would be the smoothest and fastest solution for it and probably the one eating the minimum resources (as the script would run all the time).

Guess the dll would be a solution, too, but so far I haven't understand anything about using it (moreover, there seem to be 3 dlls: a cbthook, a wineventhook a callbackhook, all mentioned in this thread...)

Last thing is of course - the hook should be fast, resizing the window best before maximizing it... Maybe a hook would be better watching the maximize/restore button press??
I thought about using WinMove() for resizing, not sure so as this makes a WinRestore() impossible, if I don't store the old x,y,w,h in a variable...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2008, 12:15 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
thewer wrote:
So I got a kind of system information bar made with AveDesk on top of my screen (Landvermesser did similar stuff with AHK I think) and I don't want maximized windows to overlap it or vize versa the bar overlapping the window/ the window buttons.
Detecting window maximize is probably the hard way. I think what you're describing can be done with "AppBars." SKAN posted a working example for creating an AppBar (see his second post), and there is also an example by Microsoft.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group