 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Tue Mar 21, 2006 4:07 pm Post subject: Tips N Tricks |
|
|
Dear Friends,
I will be posting here various tips & Title will be changing consistently, except for TipsNTricks:.
Regards,
Last edited by SKAN on Mon Jun 16, 2008 7:21 am; edited 71 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Tue Mar 21, 2006 4:07 pm Post subject: |
|
|
* Reserved * [ for notes on Windows Registry ]
Last edited by SKAN on Mon Jun 16, 2008 7:21 am; edited 4 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Tue Mar 21, 2006 4:08 pm Post subject: |
|
|
| Quote: | How to Change the Internet Explorer Window Title ?
http://www.autohotkey.com/forum/viewtopic.php?p=53455#53455
It can be changed globally, but what I detail here is the simple method to over-ride
the default title "Microsoft Internet Explorer" with a more suitable and a short name.
Anytime later, the default title can be restored without difficulty.
To Set a Custom Internet Explorer Window Title
Using Registry Editor, create the following value in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Window Title
and set it to whatever name you want ( eg. MSIE)
| Code: | NewTitle=MSIE
RegWrite, REG_SZ, HKEY_Current_USER
,Software\Microsoft\Internet Explorer\Main
,Window Title, % NewTitle |
To Remove the Custom Internet Explorer Window Title
Using Registry Editor, delete the following value in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Window Title
When you delete this value, Microsoft Internet Explorer becomes the default window title.
If you are not comfortable with the idea of using the Registry Editor or writing your own code
you may download and try the example GUI : RegPatch_001.ahk
and... this is the snapshot of the GUI

or maybe, you want to have a look at the code first. Click This : RegPatch_001.ahk.txt
|
| Quote: | Search Text:
How to remove / replace Microsoft Internet Explorer from Browser Title bar ?
Where does Windows store the Title bar suffix Microsoft Internet Explorer ?
How to change Microsoft Internet Explorer to MSIE in Browser caption ?
|
Last edited by SKAN on Mon Jun 16, 2008 7:21 am; edited 2 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Wed Mar 22, 2006 10:41 pm Post subject: |
|
|
| Quote: | How to Auto Refresh IE Window from a script ?
http://www.autohotkey.com/forum/viewtopic.php?p=53704#53704
I have this need to keep a stock quote window refreshed (atleast 6 times a minute) and I found a solution with
PostMessage (using SPY++)
Msg = 0x111 and wParam = 41504
You may test it on Internet Explorer with following code:
| Code: | #F2::
AhkID:=WinExist("A")
WinGetClass,AHKClass, ahk_id %AhkID%
If AHKClass = IEFrame
PostMessage, 0x111, 41504, 0 , , ahk_id %AhkID%
Return |
Try my IE Auto-Refresher (Beta Version) by downloading IE_Auto_Refresher.ahk
3 Steps to get it going : Run the script / The desired IE window should be active / Press F2
I am already using it, but for 2 days only. It has not been well tested!
View the code : IE_Auto_Refresher.ahk.txt
[ 0x301d6 ] seen in the Title bar is the ahk_id of that window, attached as a prefix by my script.
MSIE is the replaced suffix for "Microsoft Internet Explorer". See my previous post.
|
| Quote: |
| toralf wrote: | I'm having problems to send {F5} (the update shortcut) to an IE window that is not the active one. | Code: | ControlClick, X192 Y72, ahk_id %UniqueWinID% ;works but gets the window to front
ControlSend, , ^{F5}, ahk_id %UniqueWinID% ;doesn't work
ControlSend, ahk_parent, ^{F5}, ahk_id %UniqueWinID% ;doesn't work | ControlSend work if the window is the active one
Any ideas?
I searched the forum, but wasn't lucky.
Here is the code I used to test. | Code: | F4::
UniqueWinID := WinExist("A")
ToolTip, Found Window: %UniqueWinID%
SetTimer, RemoveToolTip, 2000
Return
F6::
ControlClick, X192 Y72, ahk_id %UniqueWinID%
; ControlSend, , ^{F5}, ahk_id %UniqueWinID%
; ControlSend, ahk_parent, ^{F5}, ahk_id %UniqueWinID%
ToolTip, Update IE %UniqueWinID%
SetTimer, RemoveToolTip, 2000
Return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
|
|
| Goyyah wrote: | I tried this and I guess it is not possible to refresh IE unless it is the "Active Window".
View the log file (created by Spy++) which contains the list of Messages for one
single click of the F5 button..
Somebody, tell me if I am wrong ... |
| Thalon wrote: | *tested*
| Code: | DetectHiddenWindows, On
r::
ControlSend, Internet Explorer_Server1, ^{F5}, Google
return |
Edit: This is just an example-contol where I sent the shortcut to.
Maybe you have to get a controllist for the actual homepage and choose one of them to send the shortcut to.
You could also tell us for what purpose you need it for?
Or did this already help to get an idea?
Thalon |
| toralf wrote: | Thanks Thalon,
The magic was in the control name "Internet Explorer_Server1" I didn't knew it and didn't found it at first with AU3_Spy.
The "DetectHiddenWindows, On" is not needed.
I want to have the AHK forums page refresh every 5 minutes. But I do not want to bring it to foreground. |
|
Last edited by SKAN on Mon Jun 16, 2008 7:22 am; edited 3 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Thu Mar 23, 2006 8:00 am Post subject: |
|
|
Last edited by SKAN on Mon Jun 16, 2008 7:22 am; edited 3 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Thu Mar 23, 2006 6:17 pm Post subject: |
|
|
| Quote: | How to start Windows Explorer with a Drive letter?
http://www.autohotkey.com/forum/viewtopic.php?p=53455#53455
This was my first post in Scripts section : If you hate Win+E to start Windows Explorer
The following code assigns 26 Hotkeys to all 26 drives.
The "Drive Letter" should be prefixed with Shift+Win Modifier.
This code opens "CabinetWClass" Explorer Window for a particular drive
| Code: | Loop 26
HotKey % "+#" Chr(A_Index+64), ExploreDrive
Return
ExploreDrive:
StringRight Drv,A_THISHOTKEY,1
ifExist %Drv%:\
Run %Drv%:\
else
Msgbox 16,[HotKey for Drive %Drv%],%Drv%: is NOT Accessible!,5
Return |
- Credit: The above is the simplified code of my original version and was posted by Laszlo. His Post.
Example:
To Explore C: press Shift+Win+C.
Likewise for D: press Shift+Win+D
and so for any drive.
Additional Tip: To open a "CabinetWClass" Explorer Window with all available drives.
| Code: | | Run explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D} ; by Chris |
|
Last edited by SKAN on Mon Jun 16, 2008 7:23 am; edited 3 times in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Sun Mar 26, 2006 9:19 pm Post subject: |
|
|
| Quote: | How to Display Shadowed Text in a GUI ?
http://www.autohotkey.com/forum/viewtopic.php?p=54227#54227
Two Similar Texts (with transparent background) can be overlapped (superimposed)
one over the another (with a slight offset) to create an effect of shadowed text.
These texts have to be colored in contrast with each other.
The following example code displays a "Shadowed Text" in a GUI
| Code: | Text= Shadowed
Gui, -Caption
Gui, Color, 5E43FF
Gui,Font, s36 Bold, Verdana
Gui, Add,Text,x4 y4 w384 h80 Center vText1 c000000 BackgroundTrans, % Text
Gui, Add,Text,x0 y0 w384 h80 Center vText2 cFFFFFF BackgroundTrans, % Text
Gui,Show,w400 h80
Return
GuiClose:
GuiEscape:
ExitApp
Return |
The result of the above code:
Seen in the above snapshot - The White colored text is vertically and
horizontally offset from the Black colored text by 4 pixels.
This might be a good technique for large sized texts only.
I use this technique when scripting an Installer with AHK.
Compare these 2 snapshots taken from a working demo.

Want to try the Demo? You may download it : ST_Demo.ahk or View the code : ST_Demo.ahk.txt
How to Display OSD with Shadowed Text : Example code is here
|
Last edited by SKAN on Mon Jun 16, 2008 7:23 am; edited 4 times in total |
|
| Back to top |
|
 |
Dippy46
Joined: 06 Jul 2004 Posts: 171 Location: Manchester, England.
|
Posted: Sun Mar 26, 2006 9:59 pm Post subject: Shadowed Text |
|
|
Nice. Simple but effective.  _________________ Simple ideas lie within reach, only of complex minds |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Mon Mar 27, 2006 11:16 pm Post subject: |
|
|
| Quote: | How to set a GUI to be " Always @ Bottom " ?
http://www.autohotkey.com/forum/viewtopic.php?p=54403#54403
I might be technically incorrect - but in layman terms,
"Always On Top" window will never be below any other window - and
"Always At Bottom" window will never be above any other window
because its a "Child window" of the Desktop.
The "sticking of the GUI" is achieved by a DllCall to User32.dll function "SetParent"
which sets the GUI to be the child window of Desktop.
Reference / Credits
Well. I was never comfortable with DllCall(), but for evl & Serenity ( & others ) who helped me to understand this
particular function on Ask for Help topic : Is there a way to write "Text" on Desktop, above Wallpaper ?
You may view Serenity's Post.
evl has posted it in Script & Functions titled : SetParent function (make a gui belong to another window).
I was hesitant in posting this but I had already written a demo ...
Always @ Bottom - How to ?
Add the following line immediately after Gui, Show
| Code: | | WinSet:=AlwaysAtBottom(WinExist("A")) |
and include the AlwaysAtBottom() function in your script
| Code: | AlwaysAtBottom(Child_ID)
{
WinGet, Desktop_ID, ID, ahk_class Progman
Return DllCall("SetParent", "uint", Child_ID, "uint", Desktop_ID)
} |
and thats it ....
The use?
You can make a GUI - a ToolWindow - without a Title bar - exactly the size of your desktop -
make this GUI always @ bottom - add small pictures to it - associate programs to these pictures
with gLabel - and what not ? This GUI will not be minimizeable and desktop will not be accessible
till this GUI is closed. A VIRTUAL DESKTOP ?
The Demo!
<O>
Seen above is a small timer-based clock that will be stuck on Desktop.
I have applied the "Shadowed Text" effect that I have explained in my previous post.
You may download the Demo : DT_Clock.ahk or View the code : DT_Clock.ahk.txt. |
| Quote: | Added: 30-Jun-2006
More efficient way of setting a GUI to be the "Child window of Desktop"
Credit: Enhancement suggested by evl on next post.
Just add these two lines in the beginning when coding a GUI:
| Code: | Gui, +Lastfound
DllCall("SetParent", UInt, WinExist() , UInt, WinExist("Program Manager")) |
.. and that would suffice !
Copy / Paste / Try Example: | Code: | Gui, +Lastfound
DllCall("SetParent", UInt, WinExist() , UInt, WinExist("Program Manager"))
Gui, Show, w400 h300, This GUI is a Child Window of Desktop
Return
GuiClose:
GuiEscape:
ExitApp
Return |
|
Last edited by SKAN on Mon Jun 16, 2008 7:24 am; edited 2 times in total |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1238
|
Posted: Mon Mar 27, 2006 11:50 pm Post subject: |
|
|
Nice, I hadn't tried to use window id's directly in my function, but I'll update my post with another example because it's even simpler this way.
Btw, it is more reliable to use something like the code below (one of Chris' tricks) to get the ID of the gui - this can be done even before showing the Gui :
| Code: |
Gui, %Gui_Number%: +LastFound
Gui_ID := WinExist()
|
|
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Tue Mar 28, 2006 9:51 pm Post subject: Re: Shadowed Text |
|
|
| Dippy46 wrote: | Nice. Simple but effective.  |
Dear Dave Perrée,
I had sent you a PM (just a thank note!), but I see you have not read it.
Thanks for the compliment! Regards, 
Last edited by SKAN on Mon Jun 16, 2008 7:24 am; edited 1 time in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Tue Mar 28, 2006 9:55 pm Post subject: |
|
|
Dear evl,
| youl wrote: | Btw, it is more reliable to use something like the code below (one of Chris' tricks) to get the ID of the gui - this can be done even before showing the Gui :
| Code: |
Gui, %Gui_Number%: +LastFound
Gui_ID := WinExist()
|
|
Thanks for posting it, I did not notice it .
Regards, 
Last edited by SKAN on Mon Jun 16, 2008 7:24 am; edited 1 time in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Thu Mar 30, 2006 10:16 pm Post subject: |
|
|
| Quote: | How to Hide , Disable or Replace Windows Start Button ?
http://www.autohotkey.com/forum/viewtopic.php?p=54863#54863
- To Hide/Show "Windows Start Button"
| Code: | Control, Hide, , Button1, ahk_class Shell_TrayWnd
Sleep, 5000
Control, Show, , Button1, ahk_class Shell_TrayWnd |
- To Disable/Enable "Windows Start Button"
| Code: | Control, Disable, , Button1, ahk_class Shell_TrayWnd
Sleep, 5000
Control, Enable, , Button1, ahk_class Shell_TrayWnd |
Replacing the "Windows Start Button" :
We have to Hide the Start Button first! The space occupied by Start Button will be empty now.
I guess we cannot add a button directly to it.
BUT!... With a DllCall to "User32.dll\SetParent" function you can set a GUI to be a
"child window" to the Taskbar & the GUI will contain the button.
Thats it ..
Important : The child GUI has a Button whose ClassNN will be Button1 (the same as Start Button !!!).
It is therefore imperative to issue a "GUI, Destroy" before attempting to Control, Show the "Start Button"
Related Posts for Reference :
Edit: Feedback will be highly appreciated!
Edit: Posted @ WISH LIST : I wish some examples were given for "Control" Command...
|
| Quote: |
I have an "Always Running Script" which has a very large & deep "Tray Menu". (My own "Start Menu")
When I forget the assigned Hotkeys to various tasks, this "Tray Menu" comes to my rescue.
I was calling the "Tray Menu" with a Hotkey Command - #Q::Menu,Tray,Show,5,5
I present a more effective way of Showing the Tray menu of a Script
. ____________
| Code: | #Persistent
#SingleInstance, Ignore
#NoTrayIcon
Control, Hide, , Button1, ahk_class Shell_TrayWnd
OnExit, Exitt
Gui, +ToolWindow -Caption
Gui, +Lastfound
GUI_ID := WinExist()
WinGet, TaskBar_ID, ID, ahk_class Shell_TrayWnd
DllCall("SetParent", "uint", GUI_ID, "uint", Taskbar_ID)
Gui, Margin,0,0
Gui, Font, S12 Bold, Times New Roman
Gui, Add,Button, w45 h30 gStartM, Start
Gui, Font, S8 Bold, Arial
Gui, Add,Button, x+0 w63 h30 gQuickM, My Menu
Gui, Show,x0 y0 AutoSize
Return
StartM:
Send ^{ESCAPE}
return
QuickM:
Menu,Tray,Show
return
Exitt:
Gui,Destroy
Control, Show, , Button1, ahk_class Shell_TrayWnd
ExitApp
Return |
|
| Quote: | Posted : 03-Apr-2006
I recieved the following code as a "Personal Message" from Thalon and I am posting it here.
@Thalon: Thanks!. Its nicely written.
Download Thalon's Code : ButtonClock_CDT_WINXP.ahk
or View it : ButtonClock_CDT_WINXP.ahk.txt
Post your Comments/Suggestions.. |
Last edited by SKAN on Mon Jun 16, 2008 7:25 am; edited 5 times in total |
|
| Back to top |
|
 |
Thalon
Joined: 12 Jul 2005 Posts: 640
|
Posted: Fri Mar 31, 2006 7:30 am Post subject: |
|
|
I really enjoy your tips and tricks!
There are many interesting thing to learn about windows
Line 46 and 47 in Button_Clock_WINXP.ahk do not work at my pc (do not know why) | Code: | IfExist, Clock.ico
Menu, Tray, Icon, Clock.ico | The script is located at my desktop (tested in subfolders too) and Clock.ico-File exists. But the script throws an error on execute line 47. | Quote: | Error: Can't load icon. The current thread will exit.
Specifically: Clock.ico
Line#
041: IfNotExist,Clock.ico
042: URLDownloadToFile,http://file.autohotkey.net/goyyah/Tips-N-Tricks/TaskBar/Clock.ico,Clock.ico
046: IfExist,Clock.ico
---> 047: Menu,Tray,Icon,Clock.ico | I have removed the 2 lines and it works fine now. But maybe you do have an idea why this can be?
Thalon _________________ AHK-Icon-Changer
AHK-IRC
deutsches Forum
SacredVault |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Fri Mar 31, 2006 9:12 am Post subject: |
|
|
Dear Thalon,
| You wrote: | | I really enjoy your tips and tricks! |
I feel glad about it..
I thought I should refrain from updating this Topic.. but I was encouraged by having a watch
on the "Total Views" of this topic.
Your reply to this Topic boosts my morale....
Thanks..
I like have more of your opinions :
1) Do you find my Communication effective? (not Grammar!) ?
2) Will the info be easily understood by a New user (Newbie) ?
3) Is the Layout of my post "Viewer Friendly" ?
| You wrote: | Line 46 and 47 in Button_Clock_WINXP.ahk do not work at my pc (do not know why)
| Code: | IfExist, Clock.ico
Menu, Tray, Icon, Clock.ico |
... maybe you do have an idea why this can be? |
I am not able to reproduce this error. Could there be some strange character between the two lines? If that is the case
| Code: | | IfExist, Clock.ico, Menu, Tray, Icon, Clock.ico |
should help.
Please give me feedback. I am not sure whether I should update the code.
Thanks, 
Last edited by SKAN on Mon Jun 16, 2008 7:26 am; edited 1 time in total |
|
| 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
|