AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tips N Tricks
Goto page Previous  1, 2, 3, 4, 5 ... 23, 24, 25  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Wed May 17, 2006 9:27 am    Post subject: Reply with quote

Very nice and creative use of the SS_ETCHEDHORZ and SS_ETCHEDVERT styles (I give away your "trade secrets"... Smile).

I get undue credit, as I only suggested to use a Picture. My solution has the advantage of allowing to change colors (but using system colors is good too) and the disavantage of necessitating an image file (or some complex trick...).
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Thu May 18, 2006 7:27 am    Post subject: Reply with quote

evl wrote:
Interesting effect. Now if you want a real challenge you can try to get your head around the line drawing code that shimanov posted a while back (and is used for the window/control highlighting in the AHK Window Info script) - I've been meaning to make a window/control highlighting function, but never enough time Laughing


I guess you are referring to Analytic graphing facility by Shimanov. Or something else?

Shimanov's code Exclamation Shocked
I am not that good in Scripting! Very Happy



Veovis wrote:
Nice Work! .............This works perfectly! Your TipsNTricks continue to amaze me! Keep up the good work!


Thank you Veovis Very Happy



PhiLho wrote:
Very nice and creative use of the SS_ETCHEDHORZ and SS_ETCHEDVERT styles (I give away your "trade secrets"... Smile).


No secrets!... Just an accidental discovery! I was attempting brute force method to Vertically center text in a Text Control and to my surprise I found this out. ( I'm yet to find a way for Vertically centering text! Or maybe it cannot be done .. Sad ... Mr.Chris? )

Philho further wrote:
I get undue credit, as I only suggested to use a Picture. My solution has the advantage of allowing to change colors (but using system colors is good too) and the disavantage of necessitating an image file (or some complex trick...).


These days I've been using your set of Binary Functions for many things. I did attempt to write a function that will create a line.bmp based on window background color.

But we have a better solution now, Simple and Straight Wink

Regards, Smile



PS: Please bear with me for delayed reply. I am using replies to *Bump* this topic at appropriate time.
_________________
Back to top
View user's profile Send private message
AGU
Guest





PostPosted: Thu May 18, 2006 8:33 am    Post subject: Reply with quote

Quote:
Please bear with me for delayed reply. I am using replies to *Bump* this topic at appropriate time.
Well let me first say I also like you Tips 'n' Tricks. Mr. Green

This brings me to the point. Why don't you just open up a nice site within the english wiki? In this way you won't have to bump the thread all the time. And you would have all html formatting possibilities offered by mediawiki. Very Happy

URL is http://www.autohotkey.com/wiki/index.php?title=Main_Page
________________
Cheers
AGU
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Sat May 20, 2006 8:39 am    Post subject: Reply with quote

Dear AGU, Smile

You wrote:
Well let me first say I also like you Tips 'n' Tricks. Mr. Green


Thanks! Very Happy

You wrote:
This brings me to the point. Why don't you just open up a nice site within the english wiki? In this way you won't have to bump the thread all the time. And you would have all html formatting possibilities offered by mediawiki. Very Happy

URL is http://www.autohotkey.com/wiki/index.php?title=Main_Page


I am already aware of wiki and have visited it... But I require feedback! My other idea is opening a webpage @ www.autohotkey.net.
I am just waiting for this topic to grow and contain rich information.

One might wonder why this topic has heavy formatting:

Digit is the MOST popular Computer magazine in INDIA.
They have been bundling Autohotkey with their supplementary DVD for the past few months. (There must be many Indians visiting here Question Exclamation .)
I have plans to publish my Scripts in Digit's DVD in the hope many readers would discover AutoHotkey's potential.
With this in my mind, I have already started to format my scripts with a descriptive header.

I am planning to use BBCode Writer's preview to create the "HTML Presentation" of my Submission CD! Very Happy

Regards, Smile
_________________
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Mon May 22, 2006 7:16 am    Post subject: Reply with quote

Quote:
How to find Internet Connection Status ?
http://www.autohotkey.com/forum/viewtopic.php?p=60892#60892

Function ConnectedToInternet( Flag )

Quote:

ConnectedToInternet() should work with all Windows OS.


    0x40 INTERNET_CONNECTION_CONFIGURED - Local system has a valid connection to the Internet, but not be currently connected.
    0x02 INTERNET_CONNECTION_LAN - Local system uses a local area network to connect to the Internet.
    0x01 INTERNET_CONNECTION_MODEM - Local system uses a modem to connect to the Internet.
    0x08 INTERNET_CONNECTION_MODEM_BUSY - No longer used.
    0x20 INTERNET_CONNECTION_OFFLINE - Local system is in offline mode.
    0x04 INTERNET_CONNECTION_PROXY - Local system uses a proxy server to connect to the Internet

    MSDN Reference: List of WinINet Functions

    The Function:
Code:
ConnectedToInternet(flag=0x40) {
Return DllCall("Wininet.dll\InternetGetConnectedState", "Str", flag,"Int",0)
}

    Copy-Paste-Try Example:
Code:
If ConnectedToInternet()
   Msgbox, 64, WinInet.dll, ONLINE!
else
   Msgbox, 48, WinInet.dll, OFFLINE!
Return

ConnectedToInternet(flag=0x40) {
Return DllCall("Wininet.dll\InternetGetConnectedState", "Str", flag,"Int",0)
}


Credits:
Thanks to Jon for his Post @ How to deal with dllcall returning boolean TRUE/FALSE? ( jordi )
Thanks to Chris for his Post @ the same topic suggesting corrections.



Quote:
Edit : 07-Oct-2006

Here is an another method using an URL to ascertain Internet Connected Status :


Code:
URL := "http://www.autohotkey.com"

If InternetCheckConnection(URL)
   Msgbox, 64, WinInet.dll  [%URL%], Connection Success!
else
   Msgbox, 48, WinInet.dll  [%URL%], Connection Failed!

Return

; The Function

InternetCheckConnection(Url="",FIFC=1) {
Return DllCall("Wininet.dll\InternetCheckConnectionA", Str,Url, Int,FIFC, Int,0)
}


Reference: Request by meter @ Help with Wininet.dll\InternetCheckConnection


_________________


Last edited by SKAN on Fri Oct 06, 2006 11:04 pm; edited 6 times in total
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Mon May 22, 2006 3:30 pm    Post subject: Reply with quote

@Goyyah: Thanks for the cool TipsNTricks topic. Just a suggestion... could you possibly rename the topic to something like Goyyah's TipsNTricks instead of changing the name each time a new Tip/trick is added? or (even better), create a new topic for each Tip/Trick. It makes it much easier that way for others to add their comments, input, etc... for a particular item. If I added a comment or suggestion for one of the Tips/Tricks near the beginning and a discussion started, this topic would become a mess that would be difficult to follow very quickly... It's already a bit of a mess now. Just a suggestion Smile .
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Mon May 22, 2006 4:53 pm    Post subject: Reply with quote

Dear corrupt, Smile

corrupt wrote:
If I added a comment or suggestion for one of the Tips/Tricks near the beginning and a discussion started, this topic would become a mess that would be difficult to follow very quickly...


That is why I have been providing a title like the following ...
Quote:
How to find Internet Connection Status ?
http://www.autohotkey.com/forum/viewtopic.php?p=60892#60892

...on top of each post. One may press the quote button - leave the first few lines - delete the rest - and start to answer.

Quote:
It's already a bit of a mess now..


Do you really think so?. I thought the index page (the first post) would take care of this. If there is some follow-up code posted by visitors I would put a link on the Original post and also reflect it in the Index Post.

It also needs mentioning here that the main posts have a White background while Replies do not.

It will be very easy for me to update these posts whenever I come out with a better solution.

Many thanks for posting your suggestion.

Regards, Smile
_________________
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Mon May 22, 2006 6:03 pm    Post subject: Reply with quote

Goyyah wrote:
Do you really think so?. I thought the index page (the first post) would take care of this. If there is some follow-up code posted by visitors I would put a link on the Original post and also reflect it in the Index Post.

Yes. The section of the forum is designed to be an index. This way any posts in a topic are for that particular topic. Honestly, although there is useful info here, I stopped trying to wade through the mess and follow the topic a while ago.

Goyyah wrote:
Many thanks for posting your suggestion.

Regards, Smile
You're welcome Smile . Again, it's just a suggestion. That's the way the forum was designed and how most people are accustomed to looking for info (one subject per topic). Many people won't take the time to wade through many pages to find the info and/or follow the discussions and may miss out on valuable information provided.

Edit: typo


Last edited by corrupt on Mon May 22, 2006 6:12 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Mon May 22, 2006 6:11 pm    Post subject: Reply with quote

Goyyah wrote:
It will be very easy for me to update these posts whenever I come out with a better solution.

You could save the url to each topic in favorites of your browser.
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Tue May 23, 2006 9:38 am    Post subject: Reply with quote

Dear corrupt, Smile

corrupt wrote:
Goyyah wrote:
It will be very easy for me to update these posts whenever I come out with a better solution.

You could save the url to each topic in favorites of your browser.


It just struck me that, I can still maintain the index on the first post of this topic and start posting the Tips as seperate topics!.
A link back to this index post can be had at each topic. Rolling Eyes

Just give me sometime to decide on this...

Regards, Smile
_________________
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Tue May 23, 2006 9:45 am    Post subject: Reply with quote

Quote:
How to Simulate a Linear Gradient ? - Part 1 & 2
http://www.autohotkey.com/forum/viewtopic.php?p=61081#61081

What is a Linear Gradient?



There is something familiar about the snapshot above!
Does it look similar to an Installer's background?

The top color starts from the Brightest blue and gradually ends with a Black color at the bottom...
...and this transition between the two colors gives it a technical name:


    Vertical Linear Gradient
.. and if the Color transition was from left to right, we can call it

    Horizontal Linear Gradient

How was the Gradient fill effected?

    Copy - Paste - Try example:

Code:
IfNotExist, bg.bmp
URLDownloadToFile
, http://autohotkey.net/goyyah/Tips-N-Tricks/Gradients/bg.bmp
, bg.bmp

Gui, Margin, 0,0
Gui, Add, Picture, x0 y0 w640 h480, bg.bmp
Gui, Show, AutoSize,  Simulating Vertical Linear Gradient [2 Pixel Bitmap]
Return

GuiClose:
GuiEscape:
 ExitApp
Return


The bg.bmp is the picture file that creates the effect.
bg.bmp is a small image file (mere 62 bytes!!)...

It is so small that it can be used as a period at the end of this line.

http://autohotkey.net/goyyah/Tips-N-Tricks/Gradients/bg.bmp

Can you see that it is a two coloured picture? Maybe with a magnifier!

Instead,

Take a look at the animation below simulating a 32:1 magnification of bg.bmp.



A small 1x2, 2 pixel Bitmap file is stretched to an enormous size of 640x480 pixels to create the Gradient fill effect

That is it!

    Notes:

  • Create a 2 pixel bitmap (1 pixel wide and 2 pixel tall) for a Vertical Linear Gradient.
  • Create a 2 pixel bitmap (2 pixel wide and 1 pixel tall) for a Horizontal Linear Gradient.
  • Select the Top/Bottom (or) Left/Right colors. A bit of creativity is required.
  • Now add it with "Gui, Add, Picture" command and use w & h options to stretch it to the required size.
  • This stretching creates the Gradient effect!

  • Unique Gradients: (256*256*256) * (256*256*256) = ??? Never mind! I am poor in Mathematics. Sad
  • You may also use the same technique to create colorful vertical / horizontal lines.

  • If you do not have Active Desktop enabled, you may use these bitmaps as stretched Wallpapers.

  • You will not be able to create these images with Paint.exe. An advanced Image editor will be required.
    I was using PaintShop Pro to create these Bitmaps. Now, I have my own BITMAP Gradient Maker.

  • Important Styles that can be used with "Gui, Add, Picture"
    • E0x200 for Sunken Button effect.
    • 0x400000 for Raised Button effect.
    • Border to wear a thin black line around the Picture.


    Vertical Linear Gradients - Snapshots

    Following are snapshots of 2 Pixel bitmaps stretched at 280x210 on a "Gui, -Caption" canvas.
    The Text seen on them are the pair of Hex Color Codes used to create them.


    ----------


    ----------


    ----------



gb1.ahk is an example that simulates both Vertical and Horizontal Gradients.


Note: See the Pillars on the left/right side on the GUI. I have simulated a Horizontal Gradient effect

The following posts contains information on the visual effects seen in the snapshot.

An example for Horizontal Linear Gradient:

Quote:
OSD Volume Control (Added 24-May-2006)


Here is the Code: OSD_VOL_Gradient.ahk
You may view it: OSD_VOL_Gradient.ahk.txt



* End of Part 1 * Very Happy Very Happy


Quote:
PART 2: ( Added: 25 May 2006 )

Dynamic Creation of a BITMAP Gradient with CreateBMPGradient()

Quote:
Foreword:

I owe my deepest gratitude to Laszlo & PhiLho for the contribution to the
AHK Community with their Binary Read/Write Routines.

Visit the topics:



CreateBMPGradient(FileName, ColorCode1, ColorCode2, Vertical)

  • Param1: File name to be created
  • Param2: A Valid Hex Color code for the Bottom (or) Left pixel. ( in RGB )
  • Param3: A Valid Hex Color code for the Top (or) Right pixel. ( in RGB )
  • Param4: 0 (or) 1 . Vertical=1 / Horizontal=0

    • Note: A BITMAP File stores the Picture upside down.
      Hence, Bottom/Left Color Code gets priority in Parameter Rank.

    Example: Gui, Add, Picture, x0 y0 w640 h480, % CreateBMP("Bg.bmp","000000","0000FF",1)


Copy / Paste / Try Example :

Code:
GradientFile=Bg.bmp
IfNotExist, %GradientFile%
   GradientFile:=CreateBMPGradient(GradientFile,"000000","FF0000",1)

Gui, Margin, 0,0
Gui, Add, Picture, x0 y0 w640 h480, %GradientFile%
Gui, Show, AutoSize,  Simulating Vertical Linear Gradient [2 Pixel Bitmap]
Return

GuiClose:
GuiEscape:
 ExitApp
Return

#Include BitmapGradient.ahk


Part 2 Incomplete! More examples to be posted!


Last edited by SKAN on Mon Jun 16, 2008 6:30 am; edited 7 times in total
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5382
Location: /b/

PostPosted: Tue May 23, 2006 10:38 am    Post subject: Reply with quote

Very interesting! I never knew that bitmaps can be used in such a way.

Goyyah wrote:
Gradient effect is not simulated in HTML
Internet Explorer can render gradients. SVG (partially supported in Bon Echo/FF2, IE7 and most newest browsers) can also display scalable gradient images (maybe PNG as well). Don't forget that some 98%-99% of Windows users have Macromedia Flash 5+ installed (shipped with Win XP I think) and Flash uses vector graphics.
_________________

Back to top
View user's profile Send private message Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue May 23, 2006 10:43 am    Post subject: Reply with quote

[EDIT] I wrote non-sense!
Note that if you use AltSubmit, you won't have gradient, so this trick works mostly with BMP images (not a problem as these images are very small)!

Goyyah: I like this topic, but changing the subject makes hard to search the old sub-topics (where did I saw this text-with-shadow effect?). You don't have to change the way you manage it, but I wanted to draw attention to the problem.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on Tue May 23, 2006 12:55 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Tue May 23, 2006 11:41 am    Post subject: Reply with quote

Dear Titan, Smile

Titan wrote:
Goyyah wrote:
Gradient effect is not simulated in HTML
Internet Explorer can render gradients. SVG (partially supported in Bon Echo/FF2, IE7 and most newest browsers) can also display scalable gradient images (maybe PNG as well). Don't forget that some 98%-99% of Windows users have Macromedia Flash 5+ installed (shipped with Win XP I think) and Flash uses vector graphics.


Thanks for the information!

I have been using outdated software Sad.
I tried stretching a 1x2 JPEG in a (table) cell (Dreamweaver 3) and it did not result in a gradient fill!.
Even as a Stretched Wallpaper, it did not display a gradient fill with Active Desktop enabled.

My OS is W2K - SP4

Regards, Smile
_________________
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Tue May 23, 2006 12:00 pm    Post subject: Reply with quote

Dear PhiLho, Very Happy

PhiLho wrote:
Goyyah: I like this topic, but changing the subject makes hard to search the old sub-topics (where did I saw this text-with-shadow effect?). You don't have to change the way you manage it, but I wanted to draw attention to the problem.


These following are actually links! Shocked Maybe I should underline them?!

Quote:



The index of Tips N Tricks is the first post of this topic and here is the link.
http://www.autohotkey.com/forum/viewtopic.php?p=53452#53452

Maybe I should listen to corrupt's suggestion to post every tip individually!

Just give me sometime to think...

The current topic in particular has taken plenty of my time.

Do you remember this topic? :How do I create a Binary file (Bitmap Image) with AHK Code?
I've been stuck on this for past two months!

Maybe I will end this topic with second part.

Regards, Smile
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5 ... 23, 24, 25  Next
Page 4 of 25

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group