Jump to content

DeskBox


torels
 Share

Recommended Posts

Been playing around with your code. Trying to make it:

1) show icon instead of box ; kind of done

2) make everything ecpt icon transparent

3) put program icons around main icon, show on mouse over

here is a gui test. Someone might find it usefull

CODE REMOVED (see last post)

note, I have lots of it commented out. this was just a draft i finished at 12:30 AM, so please give me some slack.

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Looks nice but i got come includes missing... where can i find these?

#include <foo.au3>

#include <GUIOnlyControlsVisible.au3>

sorry just comment thoes out. I am gonna remove the script from that post and update this one with the new script. Now it has the middle icon as the first selected program. It looks kinda cool. Brace for update

UPDATE

Here it is. First file gives center icon. Icon will give glitches if a link or certin file types are chosen. The add button works, but not too well. Needs ALOT of patching, but you may find parts of it usefull.

*CODE REMOVED* (update last post with stable version when avilable)

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

like it,but have some bug.

Only ment to be a GUI test.Someone can patch it up, I will try too.

Eventually want to do away with the background when small. When big, give it the gray background.

It has 9 slots so the method i am thinking of is haveing slot 5 (the middle) set first and then as you add programs it ill fill up slots 1 - 9 (skiping 5).

any thoughts?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

what if I want to add 10 links ? XD

anyway good job :D

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

what if I want to add 10 links ? XD

anyway good job :D

Ty

I would have to make it add another box, or even simpler, open itself. The idea of it is for projects, where you have the script and a few includes, or games (I have stronghold 1, 2, crusader, and Legends). If you had a game and a map editor you could put in 1 icon

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

a yes or no message ?

you mean a msgbox prompting you yes or no ?

btw

I am working on opening dirs/drives but I think that would require a custom FileOpenDialog thingy

AFAIK you can't open directorys OR drives using FileOpenDialog :D

if yes please tell me so! :D

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

I thought of that

but an Issue came immediately: "How am I supposed to know wether the user is going to add a folder OR a file ?"

And I thought:

I could use a FileSelectFolder to select a folder and then use an eventual FileOpenDialog to select a file. But it gets VERY annoying :D

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

I thought of that

but an Issue came immediately: "How am I supposed to know wether the user is going to add a folder OR a file ?"

And I thought:

I could use a FileSelectFolder to select a folder and then use an eventual FileOpenDialog to select a file. But it gets VERY annoying :D

I am exparamenting with click and draging files into the box. I will let you know when i come up with something.....

What I need help with is getting the icon of the file or the program that opens the selected file. Made a help topic at http://www.autoitscript.com/forum/index.ph...mp;#entry697384

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

I think I found an error. I add a file normally (happened to be a .exe file) and close the program. Then I moved the file to another location. When I reopened the program and moved my mouse over the gui so it expanded, an error came up saying that the file cannot be located. You could perform a check at the beginning of the script to make sure that the file exists there before the gui starts. You could even go so far as to check if the file exists before you run the program that was clicked on to make sure that the file was there. If the file isn't there, you can just provide a simple error message explaining the situation. Just my two cents.

You could also put the ini file in the application files directory so it isn't erased by system cleanup utilities like CCleaner.

You should also create an ini file if the current ini doesn't exist because a missing ini file causes error in the rest of the script sometimes (such as IniReadSectionNames).

Edited by dantay9
Link to comment
Share on other sites

Here is the beta of my gui. It uese a much simpler while loop and a lot more complicated icon system.

$icon[number of icon][1 = icon ctrl, 2 = path to execute]

#Include <Constants.au3>
;~ #Include <GDIPlus.au3>
#Include <SendMessage.au3>
#Include <StaticConstants.au3>
#Include <WinAPI.au3>

dim $Ext[1] = [0]

$i = 2

while 1
    $Key = RegEnumKey('HKCR', $i)
    if (@error) or (StringLeft($Key, 1) <> '.') then
        exitloop
    endif
    $Ext[0] += 1
    redim $Ext[$Ext[0] + 1]
    $Ext[$Ext[0]] = $Key
    $i += 1
wend

GUICreate('Test', 120, 140)

$Reg = _GetRegDefIcon($Ext[1])
$Label = GUICtrlCreateLabel($Ext[1], 10, 16, 100, 20, 0x01)
$Icon = GUICtrlCreateIcon('', 0, 36, 44, 48, 48)
_SetIcon($Icon, $Reg[0], $Reg[1], 48, 48)
$Button = GUICtrlCreateButton('Next', 25, 106, 70, 23)
GUISetState()

$i = 1

while 1
    $Msg = GUIGetMsg()
    switch $Msg
        case -3
            exit
        case $Button
            $i += 1
            if $i > $Ext[0] then
                $i = 1
            endif
            GUICtrlSetData($Label, $Ext[$i])
;~          MsgBox(0,"",$Ext[$i])
            $Reg = _GetRegDefIcon($Ext[$i])
            _SetIcon($Icon, $Reg[0], $Reg[1], 48, 48)
    endswitch
wend

func _GetRegDefIcon($Path)  
    const $DF_NAME  = @SystemDir & '\shell32.dll'
    const $DF_INDEX = 0 
    local $filename, $name, $ext, $count, $curver, $defaulticon, $ret[2] = [$DF_NAME, $DF_INDEX]    
    $filename = StringTrimLeft($Path, StringInStr($Path, '\', 0, -1))
    $count = StringInStr($filename, '.', 0, -1)
    if $count > 0 then
        $count = StringLen($filename) - $count + 1
    endif
    $name = StringStripWS(StringTrimRight($filename, $count), 3)
    $ext = StringStripWS(StringRight($filename, $count - 1), 8)
    if StringLen($ext) = 0 then
        return $ret
    endif
    $curver = StringStripWS(RegRead('HKCR\' & RegRead('HKCR\' & '.' & $ext, '') & '\CurVer', ''), 3)
    if (@error) or (StringLen($curver) = 0) then
        $defaulticon =  _WinAPI_ExpandEnvironmentStrings(StringReplace(RegRead('HKCR\' & RegRead('HKCR\' & '.' & $ext, '') & '\DefaultIcon', ''), '''', ''))
    else
        $defaulticon =  _WinAPI_ExpandEnvironmentStrings(StringReplace(RegRead('HKCR\' & $curver & '\DefaultIcon', ''), '''', ''))
    endif
    $count = StringInStr($defaulticon, ',', 0, -1)
    if $count > 0 then
        $count = StringLen($defaulticon) - $count
        $ret[0] = StringStripWS(StringTrimRight($defaulticon, $count + 1), 3)
        if $count > 0 then
            $ret[1] = StringStripWS(StringRight($defaulticon, $count), 8)
        endif
    else
        $ret[0] = StringStripWS(StringTrimRight($defaulticon, $count), 3)
    endif
    if StringLeft($ret[0], 1) = '%' then
        $count = DllCall('shell32.dll', 'int', 'ExtractIcon', 'int', 0, 'str', $Path, 'int', -1)
        if $count[0] = 0 then
            $ret[0] = $DF_NAME
            if StringLower($ext) = 'exe' then
                $ret[1] = 2
            else
                $ret[1] = 0
            endif
        else
            $ret[0] = StringStripWS($Path, 3)
            $ret[1] = 0
        endif
    else
        if (StringLen($ret[0]) > 0) and (StringInStr($ret[0], '\', 0) = 0) then
            $ret[0] = @SystemDir & '\' & $ret[0]
        endif
    endif
    if not FileExists($ret[0]) then
        $ret[0] = $DF_NAME
        $ret[1] = $DF_INDEX
    endif
;   if $ret[1] < 0 then
;     $ret[1] = - $ret[1]
;   else
;     $ret[1] = - $ret[1] - 1
;   endif
    return $ret
endfunc; _GetRegDefIcon

func _SetIcon($controlID, $sIcon, $iIndex, $iWidth, $iHeight)   
    const $STM_SETIMAGE = 0x0172    
    local $hWnd, $hIcon, $Style, $Error = false
    $hWnd = GUICtrlGetHandle($controlID)
    if $hWnd = 0 then
        return SetError(1, 0, 0)
    endif   
    $hIcon = _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight)
    if @error then
        return SetError(1, 0, 0)
    endif   
    $Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
    if @error then
        $Error = 1
    else
        _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitOR($Style, Hex($SS_ICON)))
        if @error then
            $Error = 1
        else
            _WinAPI_DeleteObject(_SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_ICON, 0))
            _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_ICON, _WinAPI_CopyIcon($hIcon))
            if @error then
                $Error = 1
            endif
        endif
    endif   
    _WinAPI_DeleteObject($hIcon)    
    return SetError($Error, 0, not $Error)
endfunc; _SetIcon

func _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight)
    local $hIcon, $tIcon = DllStructCreate('hwnd'), $tID = DllStructCreate('hwnd')
    local $ret
    $ret = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0)
    if (@error) or ($ret[0] = 0)then
        return SetError(1, 0, 0)
    endif
    $hIcon = DllStructGetData($tIcon, 1)
    if ($hIcon = Ptr(0)) or (not IsPtr($hIcon)) then
        return SetError(1, 0, 0)
    endif   
    return SetError(0, 0, $hIcon)
endfunc; _WinAPI_PrivateExtractIcon

enjoy

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

  • 1 month later...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...