AutoHotkey Community

It is currently May 26th, 2012, 6:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: October 19th, 2006, 6:22 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Hot Wallpaper Selector!

Image

Download : GUI@.exe [191k]

- Right now only BMP files can be used with this.
- Run it, and click on a thumbnail, the wallpaper will be set.
- By default it displays BMP pictures in Windows directory: C:\Windows
- You can pass a filepath parameter pointing to a different directory like:
Code:
Run, GUI@.exe "G:\Wallpaper" ; no trailing slash!!!


Regards, :)

Edit: Source code is below : http://www.autohotkey.com/forum/viewtop ... 4808#84808

This topic is related to - TipsNTricks: How to programmatically Tile/Cascade windows ?

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Last edited by SKAN on October 20th, 2006, 12:12 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2006, 6:56 pm 
Offline

Joined: April 26th, 2006, 4:10 am
Posts: 657
Location: New Mexico, USA
I like how the Selector GUI looks. Goyyah did you use the image resize option provided in AHK or some other method? Each image is a separate GUI right? I'm interested in knowing how you setup the layout like that. Does the script modify registry or use external DLL's?

By the way, could you provide a link to the script? Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2006, 8:02 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Nice choice of wallpapers...
I didn't tried, because I already have an automatic wallpaper randomizer...
Just a remark: the path display doesn't look like useful (being all the same), perhaps you should use only the file name.
"no trailing slash!!!"... detect it and remove it if needed! :-)
What are the limits on wp number? Does it scroll or page?

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2006, 11:18 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Code:
ImageFilePath = %1%
IfEqual, ImageFilePath,, SetEnv,ImageFilePath,%A_WinDir%
Gui, Margin, 0, 0
Gui +LastFound
Loop, %ImageFilePath%\*.bmp
  Gui, Add, Picture, x+1 w90 h-1 +0xCF0000 -0x80000 gSelect, %A_LoopFileLongPath%
Gui, Show, w640 h700 +Hide
DllCall( "TileWindows", uInt,WinExist(), Int,1, Int,0, Int,0, Int,0 )
Gui, Show, AutoSize, Hot Wallpaper Selector! Click on a thumbnail to select!
Return

Select:
MouseGetPos,,,,ClassNN,1
GuiControlGet, FileName,, %ClassNN%
 DllCall( "SystemParametersInfo", Int,20, Int,0, Str,FileName, Int,1 )
Return

GuiClose:
 ExitApp

Believe it.. Thats the code ... Hail Laszlo! :D

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 19th, 2006, 11:29 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Dear .AHK, :)

Quote:
I like how the Selector GUI looks.

Thanks! :D
Quote:
Goyyah did you use the image resize option provided in AHK or some other method?

No, this is different!
Quote:
Each image is a separate GUI right?

No! Just seperate picture controls!
Quote:
I'm interested in knowing how you setup the layout like that. Does the script modify registry or use external DLL's?
By the way, could you provide a link to the script? Thanks.

Sure.. I have posted the code :)

Regards, :)



Dear PhiLho, :)

Those are picture controls as you can see from the code..

Quote:
Just a remark: the path display doesn't look like useful (being all the same), perhaps you should use only the file name.

I guess that can be done only with WinSetTitle!
Quote:
"no trailing slash!!!"... detect it and remove it if needed!

That would result in 10% increase in the code size! ;)
Quote:
What are the limits on wp number?

You have to tell me that! :roll: .. er.. I do not understand!

Quote:
Does it scroll or page?

User32.dll\TileWindows tiles those controls within the GUI rectangle. While testing I found that 10-50 windows look good!

Do comment on the code! :D

Regards, :)


PS: This topic is related to - TipsNTricks: How to programmatically Tile/Cascade windows ?

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Last edited by SKAN on October 20th, 2006, 12:11 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2006, 10:53 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
wp = wallpaper...

I see, you use some clever tricks to let Windows and AHK do most of the hard job. Thus, you are more or less stuck with the long path in the title of each image.

I didn't knew you can add a title bar to a picture. You should explain what are the options you change: +0xCF0000 -0x80000
Analyzing this manually is annoying and prone to error (same values, different constants).

Likewise, I didn't knew the TileWindows function, even less that it worked on controls. Interesting for quick automatic layout.
I don't see the point of the AutoSize parameter, it does nothing, window remains at initial size.

Removing the trailing backslash:
ImageFilePath := RegExReplace(ImageFilePath, "\\$")
Short enough? :-)

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2006, 11:21 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Dear PhiLho, :)

Quote:
wp = wallpaper...


Oh! I confused it with wp parameter (Positioning and Sizing of Controls)!
So the limit should be 5000 minimum, I guess!

Quote:
I see, you use some clever tricks to let Windows and AHK do most of the hard job. Thus, you are more or less stuck with the long path in the title of each image.

I didn't knew you can add a title bar to a picture. You should explain what are the options you change: +0xCF0000 -0x80000
Analyzing this manually is annoying and prone to error (same values, different constants).


Sorry! I was very tired yesterday! ...
Tile/Cascade windows could not tile/cascade a control, So I flagged the controls with WS_TILEDWINDOW ( 0xCF0000 ) given in help as WS_OVERLAPPEDWINDOW. To remove the titlebar buttons I had to remove the WS_SYSMENU style ( -0x80000 )

Quote:
Likewise, I didn't knew the TileWindows function, even less that it
worked on controls
. Interesting for quick automatic layout.


I got the idea from the topic - Cascade Word files?. I do not have Word 97 installed, and thus this idea!

Quote:
I don't see the point of the AutoSize parameter, it does nothing, window remains at initial size.


Are you sure?. The last column moves out of the GUI rectangle In Windows 2000 & XP for me!

Quote:
Removing the trailing backslash:
ImageFilePath := RegExReplace(ImageFilePath, "\\$")
Short enough? :-)


Wow! I eagerly await the final release of AHK with built in RegEx! :D

Many Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2006, 12:05 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Goyyah wrote:
Quote:
I don't see the point of the AutoSize parameter, it does nothing, window remains at initial size.


Are you sure?. The last column moves out of the GUI rectangle In Windows 2000 & XP for me!
You are right, without it, the rightmost controls are slightly truncated in my test case. Not obvious on first sight, but now that you mention it... :-)

With more images, they become smaller. I tried add the capability to resize the window, but to avoid resizing everything in real time, I activate the re-tiling with a hotkey:
Code:
;~ ImageFilePath = %1%
ImageFilePath = Images
IfEqual, ImageFilePath,, SetEnv,ImageFilePath,%A_WinDir%
Gui, Margin, 0, 0
Gui +Resize
pictOpt = x+1 w90 h-1 +0xCF0000 -0x80000 gSelect
Loop, %ImageFilePath%\*.bmp
  Gui, Add, Picture, %pictOpt%, %A_LoopFileLongPath%
Loop, %ImageFilePath%\*.png
  Gui, Add, Picture, %pictOpt%, %A_LoopFileLongPath%
Loop, %ImageFilePath%\*.jpg
  Gui, Add, Picture, %pictOpt%, %A_LoopFileLongPath%
Loop, %ImageFilePath%\*.gif
  Gui, Add, Picture, %pictOpt%, %A_LoopFileLongPath%
Gui, Show, w640 h700 +Hide
Gosub #c
Return

Select:
MouseGetPos,,,,ClassNN,1
GuiControlGet, FileName,, %ClassNN%
DllCall( "SystemParametersInfo", Int,20, Int,0, Str,FileName, Int,1 )
Return

#c::
Gui +LastFound
DllCall( "TileWindows", uInt,WinExist(), Int,1, Int,0, Int,0, Int,0 )
Gui, Show, AutoSize, Hot Wallpaper Selector! Click on a thumbnail to select!
Return

GuiClose:
GuiEscape:
ExitApp
But the controls might get a bit overlapped when too small.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2006, 1:44 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
PhiLho wrote:
you are more or less stuck with the long path in the title of each image.


For more than one hour, I was meddling with different styles but unable to change the title.. But I have found a simple workaround:

Code:
SetWorkingDir, %A_Windir%
Gui, Margin, 0, 0
Gui +LastFound
Loop, *.Bmp
  Gui, Add, Picture, x+1 w90 h-1 +0xCF0000 -0x80000 gSelect, %A_LoopFilename%
Gui, Show, w640 h700 +Hide
DllCall( "TileWindows", uInt,WinExist(), Int,1, Int,0, Int,0, Int,0 )
Gui, Show, AutoSize, Hot Wallpaper Selector! Click on a thumbnail to select!
Return

Select:
MouseGetPos,,,,ClassNN,1
GuiControlGet, FileName,, %ClassNN%
 DllCall( "SystemParametersInfo", Int,20, Int,0, Str,FileName, Int,1 )
Return

GuiClose:
 ExitApp


Thanks for showing interest in this.. I will try your example in Win XP later!

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 20th, 2006, 11:29 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
PhiLho wrote:
Removing the trailing backslash:
ImageFilePath := RegExReplace(ImageFilePath, "\\$")
Short enough? :-)


MSDN Reference: Shell Path Handling Functions

Code:
wPath := A_WinDir
DllCall( "PathAddBackslashA", Int,&wPath )
MsgBox % wPath


It does the opposite of the RegExReplace example!
:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2006, 8:29 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
You should do a VarSetCapacity of StrLen(wPath) + 1 before the call (might do nothing, as buffer can be already bigger, but safer), then either call with "Str", wPath, or do a VarSetCapacity(wPath, -1) after because of the latest changes on computing string lengths only when needed.
So it sorts of ruin the interest of this nice little function...
Code:
ImageFilePath := RegExReplace(ImageFilePath, "([^\\])$", "$1\")
Does nothing if backslash is already there.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2006, 10:18 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
PhiLho wrote:
Code:
ImageFilePath := RegExReplace(ImageFilePath, "([^\\])$", "$1")
Does nothing if backslash is already there.


:shock:

Very nice!.. Thanks! :D

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


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

Joined: October 27th, 2006, 10:12 am
Posts: 649
PhiLho wrote:
I didn't tried, because I already have an automatic wallpaper randomizer...
? Is it an external application or an ahk solution? Can you provide any further urls on this? I'm trying to experiment with "some semi-automatic wallpaper changes". Also some preprocessing of these "preselected wallpaper images" with dynamically overlayed text onto them might be interesting. Those texts could be anything, like
    quotes
    todo lists
    source codes
    random text selections
    ...
That way the wallpaper could get a more "alive feeling" rather than always being the same. Yes and these text overlays might also change in certain time units. You could also define two separate time units for
    wallpaper image changes
and
    wallpaper overlayed text changes


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 19 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