corz.org front page. welcome! cor's blog, aka 'corzblog'. I write stuff here.. downloads of all shapes and sizes, documents, secret chasms, you name it.. developing sites, software, stuff.. updates generally get posted here. music is everywhere, sometimes I pin it down.. soul-candy, captured things you can look at.. 'Mathematics For Women' copyright Cor 1994 ;o)
the power to serve, at home or anywhere. webmasters tricks, tips, tools and resources. the devil's work, or a capable multimedia desktop, you decide..
information and search
contact page for corz.org, ways to get $hit to me.. get a print friendly version of this page, probably.. Put YOUR money where MY mouth is!
 
corz.org text viewer..
[currently viewing: /public/machine/source/windows/accessories/Clipboard_As_Name_Vista_PowerToy.au3 - raw]
 

#cs
    Clipbard As Name        v0.3.2

    A "powertoy" for Vista    (and XP/Windows 7/Windows Server/200/2003/etc.)

    Those lovely powertoys won't install in Vista, so if you are anything like 
    me, you will miss dragging stuff onto your "Clipboard As Name" SendTo icon 
    (which you copied to your desktop because it was sooo handy, right?), 
    something I did about a zillion times a day in 95/98/2K/XP.

    What started out as almost a joke (one single line of code) has actually 
    transformed into a fairly robust and useful item. After a couple of zillion
    successful drag and drop operations (no really, sometimes it's ten zillion
    a day) I feel comfortable recommending it, or a shortcut to it, for *your* 
    Vista desktop. 
    
    What is it? Too young to remember the Windows PowerToys, huh? Simply put, 
    you drag stuff onto it, and the path to that stuff is placed into the 
    system clipboard. If you ever need to type the path to a file or folder, 
    or many files and folders, ClipbardAsName is what you are looking for.
    
    So here it is, my favourite Windows PowerToy, AutoIt style..

    ;o) Cor
#ce


; coding doesn't get any easier than this!
; the original ClipbardAsName..
;if $CmdLine[0] then ClipPut($CmdLine[1])
; and there's your application!


; A slightly improved version..
;
; This version handles multiple dropped files, very handy.
; Also, holding down the Ctrl key gets you the 8.3 name(s), just like the original MS PowerToy.

$Ctrl = false
if _IsPressed(11) then $Ctrl = true

if $CmdLine[0] then
    $copy = ""
    for $i = 1 to $CmdLine[0]
        $path = $CmdLine[$i]
        if $Ctrl then $path = FileGetShortName($path)
        if StringRight($path, 1) = '"' then 
            $path = StringTrimRight($path, 1) 
            $path = StringTrimLeft($path, 1) 
        endif
        $copy &= $path & @CRLF
    next
    ClipPut(StringStripWS($copy, 3))
else
    MsgBox(0, "
Drag & Drop Only!",    "To use: Drag and drop stuff onto me, or a shortcut to me. " & @LF & @LF & _
                                    "
The path information will be placed in your system clipboard," & @LF & _
                                    "
so you can immediately paste it wherever you need (Ctrl+V). " & @LF & @LF & _
                                    "
Okay, technically, you could also launch me with paths on the " & @LF & _
                                    "
command-line, but to save typing, you would first need to get " & @LF & _
                                    "
those paths into your clipboard, which is of course, my job! ")
endif


; _IsPressed (is a key pressed?)
; Author(s): ezzetabi / Jon / Valik 
;
func _IsPressed($Key)
    local $kp = DllCall('user32.dll', "
int", "GetAsyncKeyState", "int", '0x' & $Key; does this work on Win9x ? :/
    if not @error and BitAND($kp[0], 0x8000) = 0x8000 then return 1                        ; who cares! ;o)
    return 0
endfunc


#cs
    changes..
    0.3.2    Added a usage message for if folk click directly on the exe.    I now have Vista (VM).

            Added a 256 pixel icon for Vista desktop usage, so you can sit it next to your trash, and it will
            scale all the way up with it (Ctrl+Wheel). Those are the only two icons on my desktop. Looks neat.

            I simplified the icon, removing the pencil. I think it works better on your desktop like this, though
            doesn't look quite so impressive on a web page. The former I have to look at almost every day!

    0.3.1    Fixed Vista problem with paths occasionally losing their last character. (I don't have Vista yet)

    0.3        Added Ctrl key option (8.3 file names)

    0.2        Added multiple files capability

    0.1        One line of code. cool!
#ce


"