Jump to content

Polyphem

Active Members
  • Posts

    124
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Polyphem's Achievements

Adventurer

Adventurer (3/7)

0

Reputation

  1. Two problems: The type of quotation marks you use to enclose the string need to be escaped by repeating them.Exclamation marks need to be enclosed by braces {!} to be send as character send("=CONCATENATE(""=Excel|[NewView.xls]Sheet3{!}'R"",[NewView.xls]Sheet3{!}$H$2,""C3'"")") Cheers
  2. HiHo Community, I was looking for such a function for a long time, didn't know where to start myself. Now the day before yesterday Rasim posted an excellent piece of code called ShellTreeView and I remembered having seen the TristateTreeView function from Holger some time ago... and decided to merge those two ... Rasims ShellTreeView #576433 Holgers TristateTreeView http://www.autoitscript.com/forum/index.php?showtopic=28464 ShellTristateTreeView Thanks and Kudos again to Rasim and Holger... Enjoy and Cheers Poly ShellTristateTreeView.zip
  3. Hmmmm, no... Not really , just copy&paste and some adjustments to the variables... but I guess now theres some junk in the functions... This is what I got so far, currently trying to pass the checked boxes fullpath to an array. So don't wonder bout the results when clicking "Checked Items", work-in-progress. Merged TristateTreeViewLib.au3 into ShellTreeView.au3 and changed the ShellTreeView_Example.au3 a little. Added TristateTreeViewLib.au3 to zip file for reference only. Will continue to try in the evening >_<... Have fun and Cheers Poly
  4. Sliiightly improved performance AND functions and added an example to the code. The performance is influenced heavily by the type of search performed, sloooooow with looooooots of details, quiet fast with few details. For usage in your own script I would recommend to perform SQL-Queries as needed. _SQLite_GetTable2d is not a too fast function ... Performance Test: Scan 1: 51 files, 7.8 secs (full AutoIt native + _FileGetProperty details, ProgressOn) Scan 2: 2.627 files, 2.65 secs (full AutoIt native details, ProgressOn) Scan 3: 2.627 files, 0.62 secs (minimal AutoIt native details, ProgressOn) Scan 4: 2.627 files, 0.55 secs (minimal AutoIt native details, ProgressOff) Scan 5: 30.152 files, 6.5 secs (minimal AutoIt native details, ProgressOff) => same file-set as above! Performance-Improvment of some 580% For best performance design your SQL-Queries on 'filelist' carefully, I think many operations now performed with AutoIt can be ported to SQLite... ToDo's: - Add include/exclude selection by file-extension / Regex optional - Add include/exclude selection by folder-patern / Regex optional - ... Update: Upsa, naming collision caused by _FileGetProperty() in SQL-statement due to different OS Language... tested it with German OS which returned "Größe", now working with an US language OS which returned "Size"... sadly the same name I used before for the AutoIt-native Size field... #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: Polyphem Script Function: _FileListToSqlite Script Version: v10b (2008-Sep-09) #ce ---------------------------------------------------------------------------- #include<Array.au3> #include<SQLite.au3> #include<SQLite.dll.au3> Global $hQuery, $aRow, $sTimerInit, $sTimerDif, $sScanProgressCount, $sPathSizeCount, $sProgressCount, $sProgressCountSave Local $aResult, $iRows, $iColumns, $iRval _SQLite_Startup() if @error = 1 Then MsgBox(270400,"IMPORTANT","This application uses an SQLite database component (SQLite3.dll)." & @crlf & @crlf & "It tried to install a copy in the directory" & @crlf & @crlf & @SystemDir & @crlf & @crlf & "and failed. Please check manually.") Exit EndIf _SQLite_Open() ; open :memory: Database - add filename to store information for later use $select_input_folder = FileSelectFolder ( "Select Folder to Scan..." & @crlf & @crlf & "First scan with all attributes set... choose a small folder : )...", "",2 , @ScriptDir) if $select_input_folder = true then _FileListToSqlite($select_input_folder,1,16383,1) $sFileListToSqliteError = @error MsgBox(0,"Runtime","Runtime: " & $sTimerDif & @crlf & @crlf & "SQLite returned Error-Code: " & $sFileListToSqliteError & @crlf & @crlf & "Found dirs/files: " & $sPathSizeCount) _SQLite_GetTable2d (-1, "SELECT * FROM filelist;", $aResult, $iRows, $iColumns) _ArrayDisplay($aResult) endif $select_input_folder = FileSelectFolder ( "Select Folder to Scan..." & @crlf & @crlf & "Second scan with AutoIt native functions only... choose a bigger folder *g*...", "",2 , "C:\") if $select_input_folder = true then _FileListToSqlite($select_input_folder,1,8191,1) $sFileListToSqliteError = @error MsgBox(0,"Runtime","Runtime: " & $sTimerDif & @crlf & @crlf & "SQLite returned Error-Code: " & $sFileListToSqliteError & @crlf & @crlf & "Found dirs/files: " & $sPathSizeCount) _SQLite_GetTable2d (-1, "SELECT * FROM filelist;", $aResult, $iRows, $iColumns) _ArrayDisplay($aResult) endif $select_input_folder = FileSelectFolder ( "Select Folder to Scan..." & @crlf & @crlf & "Third scan with minimal AutoIt native functions only... choose biggest folder *ggg*...", "",2 , "C:\") if $select_input_folder = true then _FileListToSqlite($select_input_folder,1,4,1) $sFileListToSqliteError = @error MsgBox(0,"Runtime","Runtime: " & $sTimerDif & @crlf & @crlf & "SQLite returned Error-Code: " & $sFileListToSqliteError & @crlf & @crlf & "Found dirs/files: " & $sPathSizeCount) _SQLite_GetTable2d (-1, "SELECT * FROM filelist;", $aResult, $iRows, $iColumns) _ArrayDisplay($aResult) endif $select_input_folder = FileSelectFolder ( "Select Folder to Scan..." & @crlf & @crlf & "Forth scan with minimal AutoIt native functions only and progress off... fastest", "",2 , "C:\") if $select_input_folder = true then _FileListToSqlite($select_input_folder,1,4,0) $sFileListToSqliteError = @error MsgBox(0,"Runtime","Runtime: " & $sTimerDif & @crlf & @crlf & "SQLite returned Error-Code: " & $sFileListToSqliteError & @crlf & @crlf & "Found dirs/files: " & $sPathSizeCount) _SQLite_GetTable2d (-1, "SELECT * FROM filelist;", $aResult, $iRows, $iColumns) _ArrayDisplay($aResult) endif $select_input_folder = FileSelectFolder ( "Select Folder to Scan..." & @crlf & @crlf & "Fifth scan with minimal AutoIt native functions only and progress off... fastest", "",2 , "C:\") if $select_input_folder = true then _FileListToSqlite($select_input_folder,1,2048,0) $sFileListToSqliteError = @error MsgBox(0,"Runtime","Runtime: " & $sTimerDif & @crlf & @crlf & "SQLite returned Error-Code: " & $sFileListToSqliteError & @crlf & @crlf & "Found dirs/files: " & $sPathSizeCount) _SQLite_GetTable2d (-1, "SELECT * FROM filelist;", $aResult, $iRows, $iColumns) _ArrayDisplay($aResult) endif _SQLite_Exec(-1, "DROP TABLE filelist;") _SQLite_Close() _SQLite_Shutdown() ;=============================================================================== ; ; Function Name: _FileListToSqlite($sPath,$sRecurse,$sFiledetails,$sShowProgress) ; Description:: ; Parameter(s): $sPath - Top Folder Location to scan (default = @scriptdir) ; $sRecurse - 0 = dont recurse, 1 = recurse (default) ; $sFiledetails (Add up values as required) => ; ; AutoIt-Functions ; ; 1 = include only Folder information ; 2 = include only File information (overrides above) ; 4 = include File AND Folder information (Default, overrides both above) ; ; 8 = include Filepath Long (Default, forced if Filepath Short is not selected) ; 16 = include Filepath Short ; 32 = include Filename Long (Default, forced if Filename Short is not selected) ; 64 = include Filename Short ; 128 = include File Extension ; 256 = include Filetime (Modified) ; 512 = include Filetime (Created) ; 1024 = include Filetime (Accessed) ; 2048 = include File-Size in Byte ; 4096 = include File-Attributes ; ; 8191 = Add all Information based on AutoIt-Functions to Table ; ; _FileGetProperty Function ; ; 8192 = Add all attributes... ; kinda overkill, but seems to be Windows Language and SP/KB dependant... all or nothing *g*... ; sadly this makes it nearly impossible to port : (... anyone got an idea? ; ; 16383 = Add all Information to Table ; ; $sShowProgress - 0 = off, 1 = on (default) ; ; Requirement(s): AutoIt 3.2.12.1 ; Return Value(s): 0 - Success ; 1 - $sPath is not a directory ; Author(s): Polyphem ; ; ;=============================================================================== ; Func _FileListToSqlite($sPath = @ScriptDir, $sRecurse = 1, $sFiledetails = 8191 , $sShowProgress = 1) Local $aNames $sTimerInit = TimerInit() $sPathSizeCount = 0 ; reset $sPathSizeCount if BitOR($sRecurse,0,1) <> 1 then $sRecurse = 1 ; if $sRecurse is not set to 0 or 1 set to 1 if BitAnd($sFiledetails, 4) Then ; if $sFiledetails contains 4 (include File AND Folder information) then subtract 1 (include only Folder information) and 2 (include only File information) if in $sFiledetails if BitAnd($sFiledetails, 2) Then $sFiledetails -= 2 EndIf if BitAnd($sFiledetails, 1) Then $sFiledetails -= 1 EndIf elseif BitAnd($sFiledetails, 2) Then ; if $sFiledetails contains 2 (include only File information) then subtract 1 if in $sFiledetails if BitAnd($sFiledetails, 1) Then $sFiledetails -= 1 EndIf Else ; else add 4 (include File AND Folder information ) to $sFiledetails (default) $sFiledetails += 4 EndIf if $sRecurse = 1 Then $sPathSize = DirGetSize($sPath, 1) Else $sPathSize = DirGetSize($sPath, 2) EndIf if @error Then Return SetError(1, 0, 0) ;Ensure $sPath is a directory, DirGetSize returns @error 1 if the path doesn't exist. if BitAnd($sFiledetails, 1) Then $sPathSizeCount = $sPathSize[2] ElseIf BitAnd($sFiledetails, 2) Then $sPathSizeCount = $sPathSize[1] Else $sPathSizeCount = $sPathSize[1]+$sPathSize[2] EndIf if $sShowProgress = 1 Then $sProgressCount = 0 ; reset $sProgressCount $sProgressCountSave = 0 ; reset $sProgressCountSave ProgressOn("Filelist Scan Progress", "Percentage done", stringformat("%3s","0") & "%, Scanning file 0 of " & $sPathSizeCount & " files") WinMove("Filelist Scan Progress","",650,250) endif _SQLite_FetchNames(-1, $aNames) _SQLite_Exec(-1, "DROP TABLE filelist;") ; How to check efficently, that table already existed : )? $sSqlBuild_Table = "" ; Start building the Query if BitAnd($sFiledetails, 8) or BitAnd($sFiledetails, 16) = false then ; Filepath Long, default and forced if Filepath Short is not selected $sSqlBuild_Table &= ',Path_Long' endif if BitAnd($sFiledetails, 16) OR BitAnd($sFiledetails, 64) then ; Filepath Short, also needed for determination of $sFileGetShortName_File final value $sSqlBuild_Table &= ',Path_Short' endif if BitAnd($sFiledetails, 32) or BitAnd($sFiledetails, 64) = false then ; Filename Long, default and forced if Filename Short is not selected $sSqlBuild_Table &= ',Name_Long' endif if BitAnd($sFiledetails, 64) then ; Filename Short $sSqlBuild_Table &= ',Name_Short' endif if BitAnd($sFiledetails, 128) then ; File Extension $sSqlBuild_Table &= ',Extension' endif if BitAnd($sFiledetails, 256) then ; Filetime (Modified) $sSqlBuild_Table &= ',Time_Modified' endif if BitAnd($sFiledetails, 512) then ; Filetime (Created) $sSqlBuild_Table &= ',Time_Created' endif if BitAnd($sFiledetails, 1024) then ; Filetime (Accessed) $sSqlBuild_Table &= ',Time_Accessed' endif if BitAnd($sFiledetails, 2048) then ; Filetime (Accessed) $sSqlBuild_Table &= ',Size' endif if BitAnd($sFiledetails, 4096) then ; File-Attributes $sSqlBuild_Table &= ',Attrib' endif if BitAnd($sFiledetails, 8192) then ; FileGetProperty Function, add all attributes $aSqlBuild_Table_FileGetProperty = _FileGetProperty(@ScriptFullPath) for $i = 1 to $aSqlBuild_Table_FileGetProperty[0][0] $sSqlBuild_Table &= ',"' & "FPG_" & $aSqlBuild_Table_FileGetProperty[$i][0] & '"' Next endif $sSqlBuild_Table &= ')' $sSqlBuild_Table = '(' & StringRight($sSqlBuild_Table,stringlen($sSqlBuild_Table)-1) _SQLite_Exec(-1, 'CREATE TABLE filelist ' & $sSqlBuild_Table & ';') _FileListToSqliteDo($sPath, $sRecurse, $sFiledetails, $sShowProgress, $sSqlBuild_Table) $sTimerDif = TimerDiff($sTimerInit) if $sShowProgress = 1 Then ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() endif if @error Then Return SetError(@error, 0, 0) EndFunc Func _FileListToSqliteDo($sPath, $sRecurse, $sFiledetails, $sShowProgress, $sSqlBuild_Table) Local $sFileExtension, $aFilelistQuery, $sFileGetAttrib If StringRight($sPath, 1) <> "\" Then $sPath &= "\" ; Ensure $sPath has a trailing slash $sSearch = FileFindFirstFile($sPath & "*.*") While 1 ; Search through all files and folders in directory $sNext = FileFindNextFile($sSearch) If @error Then ExitLoop if $sRecurse = 1 or BitAnd($sFiledetails, 128) or BitAnd($sFiledetails, 4096) or BitAnd($sFiledetails, 1) or BitAnd($sFiledetails, 2) or BitAnd($sFiledetails, 8192) Then ; FileGetAttrib needed for Recurse search OR determination of file-extension OR determination of file-attributes themselves $sFileGetAttrib = FileGetAttrib($sPath & $sNext) endif if BitAnd($sFiledetails, 1) Then ; add Folder-Flag set only If StringInStr($sFileGetAttrib, "D") = 0 Then ContinueLoop EndIf if $sShowProgress = 1 Then $sProgressCount += 1 if round($sProgressCount/$sPathSizeCount*100,0) > $sProgressCountSave Then $sProgressCountSave = round($sProgressCount/$sPathSizeCount*100,0) ProgressSet( $sProgressCountSave, stringformat("%3s",round($sProgressCount/$sPathSizeCount*100,0)) & "%, Scanning file " & $sProgressCount & " of " & $sPathSizeCount & " files") endif endif $sSqlBuild_Query = "" ; Start building the Query if BitAnd($sFiledetails, 8) or BitAnd($sFiledetails, 16) = false then ; Filepath Long, default and forced if Filepath Short is not selected $sSqlBuild_Query &= ',"' & $sPath & '"' endif if BitAnd($sFiledetails, 16) OR BitAnd($sFiledetails, 64) then ; Filepath Short, also needed for determination of $sFileGetShortName_File final value if BitAnd($sFiledetails, 64) Then $sFileGetShortName_Path = FileGetShortName($sPath) $sSqlBuild_Query &= ',"' & $sFileGetShortName_Path & '"' Else $sSqlBuild_Query &= ',"' & FileGetShortName($sPath) & '"' endif endif if BitAnd($sFiledetails, 32) or BitAnd($sFiledetails, 64) = false then ; Filename Long, default and forced if Filename Short is not selected $sSqlBuild_Query &= ',"' & $sNext & '"' endif if BitAnd($sFiledetails, 64) then ; Filename Short $sFileGetShortName_File = FileGetShortName($sPath & $sNext) $sSqlBuild_Query &= ',"' & stringright($sFileGetShortName_File,stringlen($sFileGetShortName_File)-stringlen($sFileGetShortName_Path)) & '"' endif if BitAnd($sFiledetails, 128) then ; File Extension if stringinstr($sNext,".",0,-1) > 0 AND StringInStr($sFileGetAttrib, "D") = false Then $sSqlBuild_Query &= ',"' & StringLower(StringRight($sNext,StringLen($sNext)-stringinstr($sNext,".",0,-1))) & '"' Else $sSqlBuild_Query &= ',""' $sFileExtension = "" EndIf endif if BitAnd($sFiledetails, 256) then ; Filetime (Modified) $sSqlBuild_Query &= ',"' & FileGetTime($sPath & $sNext,0,1) & '"' endif if BitAnd($sFiledetails, 512) then ; Filetime (Created) $sSqlBuild_Query &= ',"' & FileGetTime($sPath & $sNext,1,1) & '"' endif if BitAnd($sFiledetails, 1024) then ; Filetime (Accessed) $sSqlBuild_Query &= ',"' & FileGetTime($sPath & $sNext,2,1) & '"' endif if BitAnd($sFiledetails, 2048) then ; Filetime (Accessed) $sSqlBuild_Query &= ',"' & FileGetSize($sPath & $sNext) & '"' endif if BitAnd($sFiledetails, 4096) then ; File-Attributes $sSqlBuild_Query &= ',"' & $sFileGetAttrib & '"' endif if BitAnd($sFiledetails, 8192) then ; FileGetProperty Function, add all attributes $aSqlBuild_Query_FileGetProperty = _FileGetProperty($sPath & $sNext) for $i = 1 to $aSqlBuild_Query_FileGetProperty[0][0] $sSqlBuild_Query &= ',"' & $aSqlBuild_Query_FileGetProperty[$i][1] & '"' Next endif $sSqlBuild_Query &= ');' $sSqlBuild_Query = '(' & StringRight($sSqlBuild_Query,stringlen($sSqlBuild_Query)-1) If (BitAnd($sFiledetails, 2) <> 0 AND StringInStr($sFileGetAttrib, "D") = 0) or (BitAnd($sFiledetails, 1) AND StringInStr($sFileGetAttrib, "D") > 0) or BitAnd($sFiledetails, 4) Then ; Evaluate add Files-Flag, add Folder-Flag and add Files-and-Folders-Flag ; Can only be done here, because even when File-Flag only is set $sRecurse might be set and Folder-Info is needed for loop below _SQLite_Exec(-1, 'INSERT INTO filelist ' & $sSqlBuild_Table & ' VALUES' & $sSqlBuild_Query) EndIf if $sRecurse = 1 then If StringInStr($sFileGetAttrib, "D") Then _FileListToSqliteDo($sPath & $sNext ,1 , $sFiledetails, $sShowProgress, $sSqlBuild_Table) endif EndIf WEnd Return SetError(0, 0, 0) EndFunc ; http://www.autoitscript.com/forum/index.php?showtopic=34732 ;=============================================================================== ; Function Name.....: _FileGetProperty ; Description.......: Returns a property or all properties for a file. ; Version...........: 1.0.2 ; Change Date.......: 2008-07-28 ; AutoIt Version....: 3.2.12.1 ; ; Parameter(s)......: $S_PATH - String containing the file path to return the property from. ; $S_PROPERTY - [optional] String containing the name of the property to return. (default = "") ; Requirements(s)...: None ; Return Value(s)...: Success: Returns a string containing the property value. ; If $S_PROPERTY is empty, an two-dimensional array is returned: ; $av_array[0][0] = Number of properties. ; $av_array[1][0] = 1st property name. ; $as_array[1][1] = 1st property value. ; $av_array[n][0] = nth property name. ; $as_array[n][1] = nth property value. ; Failure: Returns 0 and sets @error to: ; 1 = The folder $S_PATH does not exist. ; 2 = The property $S_PROPERTY does not exist or the array could not be created. ; 3 = Unable to create the "Shell.Application" object $objShell. ; ; Author(s).........: - Simucal <Simucal@gmail.com> ; - Modified by: Sean Hart <autoit@hartmail.ca> ; - Modified by: teh_hahn <sPiTsHiT@gmx.de> ; Company...........: None ; URL...............: None ; Note(s)...........: None ;=============================================================================== Func _FileGetProperty(Const $S_PATH, Const $S_PROPERTY = "") If Not FileExists($S_PATH) Then Return SetError(1, 0, 0) Local Const $S_FILE = StringTrimLeft($S_PATH, StringInStr($S_PATH, "\", 0, -1)) Local Const $S_DIR = StringTrimRight($S_PATH, StringLen($S_FILE) + 1) Local Const $objShell = ObjCreate("Shell.Application") If @error Then Return SetError(3, 0, 0) Local Const $objFolder = $objShell.NameSpace($S_DIR) Local Const $objFolderItem = $objFolder.Parsename($S_FILE) If $S_PROPERTY Then For $i = 0 To 99 If $objFolder.GetDetailsOf($objFolder.Items, $i) = $S_PROPERTY Then Return $objFolder.GetDetailsOf($objFolderItem, $i) Next Return SetError(2, 0, 0) EndIf Local $av_ret[1][2] = [[1]] For $i = 0 To 99 If $objFolder.GetDetailsOf($objFolder.Items, $i) Then ReDim $av_ret[$av_ret[0][0] + 1][2] $av_ret[$av_ret[0][0]][0] = $objFolder.GetDetailsOf($objFolder.Items, $i) $av_ret[$av_ret[0][0]][1] = $objFolder.GetDetailsOf($objFolderItem, $i) $av_ret[0][0] += 1 EndIf Next If Not $av_ret[1][0] Then Return SetError(2, 0, 0) $av_ret[0][0] -= 1 Return $av_ret EndFunc ;==>_FileGetProperty Pls comment ... Cheers Poly
  5. Replace $aDrives = DriveGetDrive("ALL")oÝ÷ Û­«­¢+ØÀÌØíÉ¥ÙÌôÉ¥ÙÑÉ¥Ù ÅÕ½Ðí10ÅÕ½Ðì¤)½ÈÀÌØí¤ôÄѼÀÌØíÉ¥ÙÍlÁt($ÀÌØíÉ¥ÙÍlÀÌØí¥tôMÑÉ¥¹UÁÁÈ ÀÌØíÉ¥ÙÍlÀÌØí¥t¤)9áÐ in ShellTreeView.au3... Hmmm, really excellent script... I guessed it will be a real challenge to merge it with Holgers " Tristate GUI TreeView" (http://www.autoitscript.com/forum/index.php?showtopic=28464)...hmmm, maybe when I've finished my current projects ... Thanks for your efforts and Cheers Poly
  6. HiHo, an idea I had...maybe useful to some, but mainly I hope for comments - to show me how bad this idea is, - to further improve this function, - or where I ignored coding conventions ... Performance is quiet okay, some 38 seconds for >30.000 pictures. Main advantage I see is that any subsequent operation for file analyzing can now be performed on the DB. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: Polyphem Script Function: _FileListToSqlite Script Version: v03 (2008-Sep-07) #ce ---------------------------------------------------------------------------- #include<SQLite.au3> Global $hQuery, $aRow MsgBox(270400,"IMPORTANT","This application uses an SQLite database component. Make sure it is are properly installed on your machine.") _SQLite_Startup() _SQLite_Open() ; open :memory: Database _SQLite_Exec(-1, "CREATE TABLE filelist (File_Path_Long,File_Path_Short,File_Name_Long,File_Name_Short,File_Extension,File_Time_Modified,File_Time_Created,File_Time_Accessed,File_Size,File_Attrib);") $begin = TimerInit() _FileListToSqlite(@ScriptDir) $dif = TimerDiff($begin) MsgBox(0,"Runtime","Runtime: " & $dif & @crlf & "Returned Error-Code: " & @error) _SQLite_Query(-1, "SELECT * FROM filelist;", $hQuery) $i = 0 While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK $i += 1 ;MsgBox(0,"",$aRow[0] & @crlf & $aRow[1] & @crlf & $aRow[2] & @crlf & $aRow[3] & @crlf & $aRow[4] & @crlf & $aRow[5] & @crlf & $aRow[6] & @crlf & $aRow[7] & @crlf& $aRow[8] & @crlf & $aRow[9]) WEnd MsgBox(0,"","Finished, found dirs/files: " & $i) _SQLite_Exec(-1, "DROP TABLE filelist;") _SQLite_Close() _SQLite_Shutdown() ;=============================================================================== ; ; Function Name: _FileListToSqlite($sPath) ; Description:: ; Parameter(s): $sPath - Top Folder Location to scan ; $sRecurse - 0 = dont recurse, 1 = recurse ; Requirement(s): AutoIt 3.2.12.1 ; Return Value(s): 0 - Success ; 1 - $sPath is not a directory ; Author(s): Polyphem ; ; ;=============================================================================== ; Func _FileListToSqlite($sPath = @ScriptDir,$sRecurse = 1) if StringInStr(FileGetAttrib($sPath), "D") = false Then Return SetError(1, 0, 0) If StringRight($sPath, 1) <> "\" Then $sPath &= "\" ;Ensure starting folder has a trailing slash $sSearch = FileFindFirstFile($sPath & "*.*") While 1 ;Search through all files and folders in directory $sNext = FileFindNextFile($sSearch) If @error Then ExitLoop if stringinstr($sNext,".",0,-1) > 0 Then $sFileExtension = StringRight($sNext,StringLen($sNext)-stringinstr($sNext,".",0,-1)) Else $sFileExtension = "" EndIf _SQLite_Exec(-1, 'INSERT INTO filelist (File_Path_Long,File_Path_Short,File_Name_Long,File_Name_Short,File_Extension,File_Time_Modified,File_Time_Created,File_Time_Accessed,File_Size,File_Attrib) VALUES' & '("' & $sPath & '","' & FileGetShortName($sPath) & '","' & $sNext & '","' & FileGetShortName($sNext) & '","' & $sFileExtension & '","' & FileGetTime($sPath & $sNext,0,1) & '","' & FileGetTime($sPath & $sNext,1,1) & '","' & FileGetTime($sPath & $sNext,2,1) & '","' & FileGetSize($sPath & $sNext) & '","' & FileGetAttrib($sPath & $sNext) & '");') If StringInStr(FileGetAttrib($sPath & $sNext), "D") AND $sRecurse = 1 Then _FileListToSqlite($sPath & $sNext) EndIf WEnd Return SetError(0, 0, 0) EndFunc Cheers and a nice sunday m8s Poly
  7. It's in the help-file... Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d ;;;; Body of program would go here ;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc
  8. Took quiet some time to find a working piece of code for this one , no worries, didnt search fulltime ... #include "Constants.au3" ; create a file "äßöüßü^.txt" in the script root... notice the difference in the msgbox regarding the output of ; in the OEM2ANSI version the output for is ' ; in the CHCP1252 version the output for is ; ; of course the codepage can be set to anything you need : ).... reference for windows codepages can be found here http://www.microsoft.com/globaldev/reference/cphome.mspx ;---------------------------------------- @ComSpec with _OEM2ANSI --------------------------------- $line = "" $foo = Run(@ComSpec & " /c dir", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend $output_comspec_oem2ansi = _OEM2ANSI($line) ;---------------------------------------- @ComSpec with chcp 1252 --------------------------------- $line = "" $foo = Run(@ComSpec, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo, "chcp 1252" & @CRLF) ; change codepage for cmd.exe instance to 1252 (West European Latin) StdinWrite($foo, "dir" & @CRLF) StdinWrite($foo, "exit" & @CRLF) ; send exit command to trigger stdout While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend $keyword_dir = stringinstr($line,">dir")+6 ; to purge the output of the "chcp 1252" command $keyword_colon = stringinstr($line,":",0,-1)-5 ; to purge the output of the "exit" command $line = StringMid($line,$keyword_dir,stringlen($line)-(stringlen($line)-$keyword_colon)-$keyword_dir) $output_comspec_chcp1252 = $line ;---------------------------------------- Output --------------------------------- MsgBox(0, "Stdout OEM2ANSI", $output_comspec_oem2ansi) MsgBox(0, "Stdout chcp 1252", $output_comspec_chcp1252) Exit ;---------------------------------------- Func --------------------------------- Func _OEM2ANSI($what) $ret = DllCall('user32.dll', 'Int', 'OemToChar', 'str', $what, 'str', '') Return $ret[2] EndFunc ;==>_OEM2ANSI For me it works fine this way. Anyone got reasons why not to use Codepage 1252? Though I fear it would only work for Western Code. Any comments are welcome... Cheers
  9. Holger did something like that... http://www.autoitscript.com/forum/index.php?showtopic=28464
  10. Found it, disabled the control before the navigate to blank... strange, at home it worked that way... #include<IE.au3> #include<GuiConstantsEx.au3> #include<WindowsConstants.au3> Global $width = 300 Global $height = 300 Global $oIE[2],$ctrloIE[2] $gui = GUICreate("TestGUI", 640, 530, 0, 0, $WS_SYSMENU + $WS_CLIPCHILDREN) $oIE[0] = _IECreateEmbedded() $ctrloIE[0] = GUICtrlCreateObj($oIE[0], 10, 110, 300, 300) _IENavigate($oIE[0], "about:blank") _IEPropertySet($oIE[0], "height", $height) _IEPropertySet($oIE[0], "width", $width) $oIE[0].document.body.background.resize $oIE[0].document.body.scroll = "no" $oIE[0].document.body.style.border = "0px" GUICtrlSetState($ctrloIE[0], $GUI_DISABLE) $oIE[1] = _IECreateEmbedded() $ctrloIE[1] = GUICtrlCreateObj($oIE[1], 330, 110, 300, 300) _IENavigate($oIE[1], "about:blank") _IEPropertySet($oIE[1], "height", $height) _IEPropertySet($oIE[1], "width", $width) $oIE[1].document.body.background.resize $oIE[1].document.body.scroll = "no" $oIE[1].document.body.style.border = "0px" GUICtrlSetState($ctrloIE[1], $GUI_DISABLE) _IEBodyWriteHTML ($oIE[0], "ctrl1") _IEBodyWriteHTML ($oIE[1], "ctrl2") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop EndIf WEnd
  11. Oh, noch ein Hamburger , na, einen Versuch wars wert (was worth a try)...
  12. _WinAPI_Mouse_Event()
  13. Maybe this? #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("04", $dll) Then MsgBox(0,"_IsPressed", "Middle mouse button Pressed") ExitLoop EndIf WEnd DllClose($dll)
  14. No magic there... 327, 94 is the inner size of the gui... 333x119 the outer size...
×
×
  • Create New...