Jump to content
Sign in to follow this  
myspacee

Selective folders selection

Recommended Posts

myspacee

Hello to all,

I've an idea for a simple recovery tool.

tool :

- access to machine disk with WinPE bootcd (BartPe)

- ask for profile to backup

- list folders in profile

- allow user to select which folder to backup (maybe listing their size)

- calcolate space disk needed for selection

- ask for directory to save to

miss some info about possibility to prompt user for selective folder list, eg:

Posted Image

Anyone can suggest me a valid FUNC to start ?

thank you,

m.

Share this post


Link to post
Share on other sites
Xenobiologist

Any reason why you do not want to use any freeware which is out there? rsync, robocoby, ...


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
myspacee

thank you for question,

I talk bout recovery boot cd. I want to give user (medium skill)

to save own files, or guide by phone/documentation.

Need graphical tool cause people usually are scred by consoles...

I'm IT 'monkey', with several geographical nodes, and more than 500 PC to assist.

If exist a tool suggest me. I know windows XP but don't know if work in BartPe.

Have an Autoit script can give more freedom to data recovery task.

thank you for attention,

m.

Edited by myspacee

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

if you doing it from a CD, then you have the problem where to store the temp data.

Normally, you should be able to run a protable app (there are some backup tools which are protable)

and run it from a cd or better USB drive.

Anyhow, if want to do it with Autoit, then lets go on with that task alothough it would be easier using an already done application. :mellow:


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
myspacee

Xenobiologist i'm with you for use an already done tool.

Don't know any at this moment and i'm still searching.

Anyway, is there any AI func that allow selective folder list

as showed in a post picture ?

m.

Edited by myspacee

Share this post


Link to post
Share on other sites
Xenobiologist

There are tools enough, but maybe this gets you started.

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
#include <StructureConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>

$hGui = GUICreate('FileExplorer', 400, 400)
$hTreeview = GUICtrlCreateTreeView(10, 10, 380, 360, BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES));, $TVS_CHECKBOXES)
$hWndTreeview = GUICtrlGetHandle($hTreeview)
$hOk = GUICtrlCreateButton('Ok', 240, 375, 60, 22)
$hCancel = GUICtrlCreateButton('Cancel', 320, 375, 60, 22)

$hImage = _GUIImageList_Create(16, 16, 5, 1)
_GUIImageList_AddIcon($hImage, 'shell32.dll', 3) ; Verzeichnis-Icon
_GUIImageList_AddIcon($hImage, 'shell32.dll', 110) ; Verzeichnis-Icon mit Haken
_GUIImageList_AddIcon($hImage, 'shell32.dll', 1) ; Datei-Icon
_GUIImageList_AddIcon($hImage, 'shell32.dll', 5) ; Diskette
_GUIImageList_AddIcon($hImage, 'shell32.dll', 7) ; Wechseldatenträger
_GUIImageList_AddIcon($hImage, 'shell32.dll', 8) ; Festplatte
_GUIImageList_AddIcon($hImage, 'shell32.dll', 11) ; CDROM
_GUIImageList_AddIcon($hImage, 'shell32.dll', 12) ; Netzwerklaufwerk
_GUIImageList_AddIcon($hImage, 'shell32.dll', 53) ; Unbekannt
_GUICtrlTreeView_SetNormalImageList($hTreeview, $hImage)

GUISetState()
GUICtrlSetStyle($hTreeview, Default, $WS_EX_COMPOSITED + $WS_EX_CLIENTEDGE)

$aDrives = DriveGetDrive('ALL')
ToolTip('Please wait...', Default, Default, 'Read Directory', 1)
For $i = 1 To $aDrives[0]
    $iLWindex = 0
    Switch DriveGetType($aDrives[$i])
    Case 'Fixed'
    $iLWindex = 5
    Case 'CDROM'
    $iLWindex = 6
    Case 'RAMDisk'
    $iLWindex = 7
    Case 'Removable'
    $iLWindex = 4
    If StringLeft($aDrives[$i], 2) = 'a:' Or StringLeft($aDrives[$i], 2) = 'b:' Then $iLWindex = 3
    Case Else
    $iLWindex = 8
    EndSwitch
    $hRoot = _GUICtrlTreeView_Add($hTreeview, $hTreeview, StringUpper($aDrives[$i]), $iLWindex, $iLWindex)
    If DriveStatus($aDrives[$i]) <> 'READY' Then ContinueLoop
    _GUICtrlTreeView_BeginUpdate($hTreeview)
    _GUICtrlTreeView_FileExplorerRecursive($hTreeview, $hRoot, $aDrives[$i], 1)
    _GUICtrlTreeView_EndUpdate($hTreeview)
Next
ToolTip('')

GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY')
While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $hCancel
    Exit
    Case $hOk
    $iSelect = _GUICtrlTreeView_GetSelection($hTreeview)
    $sTree = StringReplace(_GUICtrlTreeView_GetTree($hTreeview, $iSelect), '|', '\')
    MsgBox(0, 'Selected Path/File', $sTree)
    EndSwitch
WEnd

Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    GUIRegisterMsg($WM_NOTIFY, '')
    Local $hWndFrom, $iCode, $tNMHDR
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
    $iCode = DllStructGetData($tNMHDR, 'Code')
    If $hWndFrom = $hWndTreeview And $iCode = $NM_CLICK Then
    ToolTip('Please wait...', Default, Default, 'Read Directory', 1)
    _GUICtrlTreeView_FileExplorer($hGui, $hTreeview)
    ToolTip('')
    EndIf
    GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY')
    Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY

Func _GUICtrlTreeView_FileExplorer($hGui, $hTreeview)
    Local $aTVPos, $aPos, $hItem, $hChild, $sTree
    $aTVPos = ControlGetPos($hGui, '', $hTreeview)
    $aPos = GUIGetCursorInfo($hGui)
    $hItem = _GUICtrlTreeView_HitTestItem($hTreeview, $aPos[0], $aPos[1] - $aTVPos[1])
    If _GUICtrlTreeView_GetExpanded($hTreeview, $hItem) Then Return
    $hChild = _GUICtrlTreeView_GetFirstChild($hTreeview, $hItem)
    If $hChild <> 0 Then
    _GUICtrlTreeView_BeginUpdate($hTreeview)
    $sTree = StringReplace(_GUICtrlTreeView_GetTree($hTreeview, $hChild), '|', '\')
    _GUICtrlTreeView_DeleteChildren($hTreeview, $hChild)
    _GUICtrlTreeView_FileExplorerRecursive($hTreeview, $hChild, $sTree, 1)
    Do
    $hChild = _GUICtrlTreeView_GetNextChild($hTreeview, $hChild)
    If $hChild <> 0 Then
    $sTree = StringReplace(_GUICtrlTreeView_GetTree($hTreeview, $hChild), '|', '\')
    _GUICtrlTreeView_DeleteChildren($hTreeview, $hChild)
    $iTimer = TimerInit()
    _GUICtrlTreeView_FileExplorerRecursive($hTreeview, $hChild, $sTree, 1)
    EndIf
    Until $hChild = 0
    _GUICtrlTreeView_EndUpdate($hTreeview)
    EndIf
EndFunc ;==>_GUICtrlTreeView_FileExplorer

Func _GUICtrlTreeView_FileExplorerRecursive($hTreeview, $hItem, $sPath, $iRec)
    Local $aDirList, $aFileList, $tmp
    If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
    $iRec -= 1
    $aDirList = _MyFileListToArray($sPath, 2)
    If IsArray($aDirList) Then
    For $sDir In $aDirList
    $tmp = _GUICtrlTreeView_AddChild($hTreeview, $hItem, $sDir, 0, 1)
    If $iRec > 0 Then _GUICtrlTreeView_FileExplorerRecursive($hTreeview, $tmp, $sPath & $sDir, $iRec)
    Next
    EndIf
    $aFileList = _MyFileListToArray($sPath, 1)
    If IsArray($aFileList) Then
    For $sFile In $aFileList
    $tmp = _GUICtrlTreeView_AddChild($hTreeview, $hItem, $sFile, 2, 2)
    Next
    EndIf
EndFunc ;==>_GUICtrlTreeView_FileExplorerRecursive

Func _MyFileListToArray($sPath, $iFlag)
    Local $sFileList = '', $hSearch, $sFile
    $hSearch = FileFindFirstFile($sPath & '*')
    If @error Then Return
    While True
    $sFile = FileFindNextFile($hSearch)
    If @error Then ExitLoop
    If ($iFlag + @extended = 2) Then ContinueLoop
    $sFileList &= $sFile & '|'
    WEnd
    FileClose($hSearch)
    If $sFileList = '' Then Return
    Return StringSplit(StringTrimRight($sFileList, 1), '|', 2)
EndFunc ;==>__FileListToArray

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
myspacee

wow

Share this post


Link to post
Share on other sites
Xenobiologist

That has nothing to do with World of Warcraft! :mellow::(:lol:

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
myspacee

ok,

start to make script and implement example.

But encounter a problem :

_GUICtrlTreeView_GetTree Retrieve all items text

but

_GUICtrlTreeView_GetSelection collect only currently selected item

So i can't obtain full list of selected obj in tree.

Which function list all selected items ?

Thank you again,

m.

Share this post


Link to post
Share on other sites
myspacee

up,

anyone can give an hint ?

thank you,

m.

Share this post


Link to post
Share on other sites
myspacee

up,

any luck can't find any examples that do

recursive check for eery elements in tree.

anyone can help, please?

m.

Share this post


Link to post
Share on other sites
GEOSoft

I'm not going to type it all out right now but you may want to do something along the lines of

$iCount = _GUICtrlTreeView_GetCount($hWnd)

For $i = 0 to $iCount
    If _GUICtrlTreeView_GetChecked($hWnd, $1) Then ;; Do something here
Next

Suggestion: look at the _GUICtrlTreeView_*() functions in the help file because there are several other functions which could be of use to you

_GUICtrlTreeView_IsParent()

_GUICtrlTreeView_GetChildCount()

_GUICtrlTreeView_GetState()

and on and on.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
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
Sign in to follow this  

×