Jump to content

Script holder ? who , where ;-)


JoeCool
 Share

Recommended Posts

So it's seems (except for Scite user) noone has that kind of script holder :)

So ... I created a silly simple one.

Feel free to use or abuse it :whistle:

Thanks for help of people with finding treeViewItem ID :)

Howto:

Put it into a folder and run it ;-)

It will display folder , sub folder and scripts :lmao:

#include <guiconstants.au3>
#include <guiTreeView.au3>


func xguiCtrlTreeViewGetParentID($idTreeView, $idTVItem = 0)
   local $hParent, $hTVItem

   if $idTVItem = 0 then
     $hTVItem = guiCtrlSendMsg($idTreeView, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
   else
     $hTVItem = guiCtrlGetHandle($idTVItem)
   endif
   if $hTVItem = 0 then return 0
   $hParent = guiCtrlSendMsg($idTreeView, $TVM_GETNEXTITEM, $TVGN_PARENT, $hTVItem)
   return( xguiCtrlTreeViewItemGetID( $idTreeView,  $hParent ))
endFunc

func xguiCtrlTreeViewItemGetID( $idTreeView, $hTVItem )
   local $stTVITEM = dllStructCreate("uint;dword;uint;uint;ptr;int;int;int;int;dword")

   dllStructSetData($stTVITEM, 1, $TVIF_PARAM)
   dllStructSetData($stTVITEM, 2, $hTVItem )
   if guiCtrlSendMsg($idTreeView, $TVM_GETITEM, 0, dllStructGetPtr($stTVITEM)) <> 0 then
      return dllStructGetData($stTVITEM, 10)
   else
      return(0)
   endif
endfunc


func doFolder( $pfolder, byref $tvi  )
   local $fileIter, $file, $str, $item

   $fileIter = fileFindFirstFile( $pfolder & "*" )
   if $fileIter <> -1 then
      while 1
         $file = fileFindNextFile( $fileIter )
         if @error then exitloop

         $str = fileGetAttrib( $pfolder & $file )
         if stringInStr( $str, "D" ) > 0 then
            $item = guiCtrlCreateTreeViewItem( $file, $tvi )
            doFolder( $pfolder & $file & "\", $item )
         endif
      wend
      fileClose( $fileIter )
   endif

   $fileIter = fileFindFirstFile( $pfolder & "*.au3" )
   if $fileIter <> -1 then
      while 1
         $file = fileFindNextFile( $fileIter )
         if @error then exitloop

         $str = fileGetAttrib( $pfolder & $file )
         if stringInStr( $str, "D" ) = 0 then
            guiCtrlCreateTreeViewItem( $file, $tvi )
         endif
      wend
      fileClose( $fileIter )
   endif
endfunc


func wndClose()
  exit
endfunc

func btnExe()
   local $id = guiCtrlRead( $tvw ), $str = ""

   while $id <> 0
      $str = _guiCtrlTreeViewGetText( $tvw, $id ) & "\" & $str
      $id = xguiCtrlTreeViewGetParentID( $tvw, $id )
   wend
   $str = stringTrimRight( $str, 1 )
   if $str <> "" and stringInStr( fileGetAttrib( $str ), "D" ) = 0 then
      $str = "cmd /c " & """" & @ScriptDir & "\" & $str & """"
      runWait( $str, "", @SW_HIDE  )
   endif
endfunc


;---------------------------------------------------------------------------
;App

opt( "GUIOnEventMode", 1)

$flag = bitOr( $WS_SYSMENU, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)
$gui = guiCreate( "Silly Script", 200 , 400, 50, 50, $flag )

guiSetOnEvent( $GUI_EVENT_CLOSE, "wndClose" )

$btnExe = guiCtrlCreateButton( "Execute :-)", 5, 5, 200-10, 25 )
guiCtrlSetOnEvent( -1, "btnExe" )

$flag = bitOr( $tvs_hasbuttons, $tvs_haslines, $tvs_linesatroot, $tvs_disabledragdrop, $tvs_showselalways)
$tvw = guiCtrlCreateTreeView( 5, 35, 200-10, 400-40, $flag, $ws_ex_clientedge)

guiSetState( @SW_SHOW )


;---------------------------------------------------------------------------
;Ready ! Go !

doFolder( @ScriptDir & "\", $tvw )
while 1
   sleep( 10000 )
wend
exit
Link to comment
Share on other sites

There is a clipboard extension some where on here... I cant find it at the moment.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

#include <GUIConstants.au3>

Global Const $WM_DRAWCLIPBOARD = 0x0308
Global Const $WM_CHANGECBCHAIN = 0x030D

Global $origHWND

$gui = GUICreate("Clip Hook",400,400,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU))

; remember last clip viewer in queue and set our GUI as first in queue
$origHWND = DLLCall("user32.dll","hwnd","SetClipboardViewer","hwnd",$gui)
$origHWND = $origHWND[0]

GUIRegisterMsg($WM_DRAWCLIPBOARD,"OnClipBoardChange")
GUIRegisterMsg($WM_CHANGECBCHAIN,"OnClipBoardViewerChange")

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

; send notification that we no longer will be in clipboard hook queue
DLLCall("user32.dll","int","ChangeClipboardChain","hwnd",$gui,"hwnd",$origHWND)
Exit

Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam)
; do what you need when clipboard changes
    ToolTip(ClipGet())
    Sleep(3000)
    ToolTip("")
    
; send notification about clipboard change to next clipviewer
    dllcall("user32.dll","int","SendMessage","hWnd",$origHWND,"int",$WM_DRAWCLIPBOARD,"int",$wParam,"int",$lParam)
EndFunc

Func OnClipBoardViewerChange($hWnd, $Msg, $wParam, $lParam)
; if our remembered previous clipviewer is removed then we must remember new next clipviewer
; else send notification about clipviewr change to next clipviewer
    If $wParam = $origHWND Then
        $origHWND = $lParam
    Else
        dllcall("user32.dll","int","SendMessage","hWnd",$origHWND,"int",$WM_CHANGECBCHAIN,"hwnd",$wParam,"hwnd",$lParam)
    EndIf
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...