hi im stuck with this I want to transfer the correct file in the existing folder
#include <File.au3> #include <AutoItConstants.au3> #include <Array.au3> $Read = "C:\New folder (3)" $FLFiles1 = _FileListToArrayRec($Read, "*.xlsx", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT, $FLTAR_NOPATH) _ArrayDisplay($FLFiles1) For $i = 0 To UBound($FLFiles1) - 1 $STR = StringTrimRight($FLFiles1[$i], 5) ConsoleWrite($STR & @CRLF) $dirS = DirGetSize($Read & "\" & $STR) If $dirS = -1 Then MsgBox(16, $STR, $dirS) Else FileMove($Read, $Read & "\" & $STR & "\" & $STR & ".xlsx") EndIf next I have 3 folders under "C:\New folder (3)" and I have 5 excel files:
C:\New folder (3)\1
C:\New folder (3)\3
C:\New folder (3)\5
1.xlsx (value of column A are all 1)
2.xlsx (value of column A are all 2)
3.xlsx (value of column A are all 3)
4.xlsx (value of column A are all 4)
5.xlsx (value of column A are all 5)
I run the above script and those excel file 1, 3, 5 was transfered in the 1, 3, and 5 folders but the value of transfered file in Column A are different and file no. 4 and 5 still remains in the folder "C:\New folder (3)".... ???
whats wrong with the script???
I'm trying to use the FileMove function to rename a bunch of text files.
Some of the files have "_1" at the end of their name, for example, "File123_1.txt". I want to remove the "_1" so it would become "File123.txt".
What I currently have...
FileMove($sSource & "\*_1.txt", $sDestination & "\*.txt")
But since I'm using a wildcard, it doesn't appear to be working. I think it's just replacing .txt with .txt. Am I going about this the wrong way? How can I use wildcards and still accomplish this?
Any help is greatly appreciated ^__^
I came here with maybe too specific questions about uncommon things, but as people says, I don't lose anything trying to asking here
There's long time that I have a little "experimental" idea: Use windows desktop and it icon system like old videogame consoles (where "sprites" are used to draw things on screen, can be manipulated/animated to make interesting things happen). Some of that inspiration came from another experiments from demoscene.
Researching the possibilities of doing something like that (maybe not so intense) I found that the Windows Desktop uses a GuiListView to show and arrange icons (and of course, AutoIt provides UDF's for that ). So, I'm used that UDF to create dummy icons (not putting files on Desktop, just modifiying the "GUI layer" of desktop for put non-working icons), setting custom values like coordinates, name and Icon (from a list of loaded icons in the GuiListView). As you can see in next image works well in Windows XP... even in Windows 95 (that's not the case from Windows Vista to 10, but I already posted another question here about that... anyways, for now I'm working that with a isolated XP machine... sigh).
Another video doing an animation with that:
How I make that custom icons? Here:
$hWnd = ControlGetHandle("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") $newItem = _GUICtrlListView_AddItem ( $hWnd, "TEST", 32 ) ; with an icon of index 32 _GUICtrlListView_SetItemPosition ( $hWnd, $newItem, 300, 300 ) ; set some example property. Put in X=300 Y=300 Okay, so the next phase was changing the icons with custom ones. And here starts the issues. As AutoIT help says, icons from GuiListView came from a loaded GUIImageList, which, seeing past images I conclude that it's already preloaded with some sort of most used icons (something like an icon cache?). But If I modify it (or create another GUIImageList and then put into the GuiListView) the icons became corrupted and replaced with blank ones. (can be reverted deleting IconCache.db, just like when windows shows wrong icons in desktop).
How I change icons? Here
$hImage = _GUIImageList_Create(48, 48, 5) ; create an image list for 48x48 icons $newIcon = _GUIImageList_AddIcon($imageList, @SystemDir & "\shell32.dll", 110) ; just adding a new icon in the image list _GUICtrlListView_SetImageList($hWnd, $hImage, 0) ; $hwnd is the desktop hwnd Another option as workaround for setting icons was getting the desktop GUIImageList, and modifiyng it directly. I otbtain a GUIImageList handle, but ... without any images inside! (That's strange beacuse, when I set desktop item icons without altering the GUIImageList, it applies correctly). And finally if I try to add new ones, it returns -1 with @error setted.
How I'm trying to get desktop GUIImageList? Here.
$imageList = _GUICtrlListView_GetImageList ( $hWnd, 0 ) MsgBox(0,_GUIImageList_GetImageCount ( $imageList ), $imageList) ; getting image count and GUIImageList handle $newIcon = _GUIImageList_AddIcon($imageList, @SystemDir & "\shell32.dll", 110) ; adding icons without success So, what is the question? There's something wrong I'm doing while trying to set the new icon set on desktop? Or desktop icons work in different way than the rest of the GuiListView's? Or there's something really stupid that I can't saw before that corrupts the icons?
Also... if there's not known solution for that, do you have some idea for doing a workaround for that? Or another crazy idea? (Maybe putting real files instead dummy icons could be a solution ... a very slow one). Or even maybe (maybe not, I sure about that xD) do you want to help with this "experiment".
Thanks in advance, have a good day
How can i make function _ExplorerGetSelectedItems get selecteds items on the Desktop?
Func _ExplorerGetSelectedItems($sCabinetWClass="[CLASS:CabinetWClass]") Local $Ret = "" Local $aIndexes, $sSelected, $sSelected_Path Local $hSearch, $sCurrentFile $sSelected_Path = ControlGetText($sCabinetWClass, "", "Edit1") ConsoleWrite($sSelected_Path&@CRLF) $aIndexes = StringSplit(ControlListView($sCabinetWClass, "", "SysListView321", "GetSelected", 1), "|") If $aIndexes = 1 And ($aIndexes == "" Or $aIndexes = 0) Then Return SetError(1, 0, 0) For $i = 1 To $aIndexes $sSelected = ControlListView($sCabinetWClass, "", "SysListView321", "GetText", $aIndexes[$i]) $sCurrentFile = StringRegExpReplace($sSelected_Path, "\\+$", "") & "\" & $sSelected If Not FileExists($sCurrentFile) Then ;Search the extension for file... $hSearch = FileFindFirstFile($sCurrentFile & ".*") If $hSearch <> -1 Then $sSelected = FileFindNextFile($hSearch) FileClose($hSearch) EndIf EndIf ;Check if item is a directory If StringInStr(FileGetAttrib($sCurrentFile), "D") > 0 Then $sSelected = "*"&$sSelected $Ret = $Ret&$sSelected&Chr(10) Sleep(1) Next Return $Ret EndFunc
As a newby i need some help.
I am trying to add time stamps to file names.
But it has to do it only once. So i made a check on lenght of filename.
If filename extention and Lenght is correct it renames the file with a time stamp.
I use a ini file for settings. and extentions what needs to be renamed.
The script works but only once.
it renames all the files that are in the ini . like test.txt to text050102.txt
But when there is 2 files. Like test.txt and text050102.txt
It does not rename the test.txt file
where am i doing this wrong?
#include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $path = IniRead("RenameFiles.ini","General","InputFolder","Error") $TimeOption = IniRead("RenameFiles.ini","General","TimeOption","Error") Local $aArray = iniReadSection("RenameFiles.ini","EXT") For $i = 1 To $aArray $search01 = FileFindFirstFile($path&"*"&$aArray[$i]) If $aArray="" Then MsgBox(0,"Error","Check RenameFiles.ini","","") Exit EndIf While 1 $File = FileFindNextFile($search01) $StringLenght= StringLen ($File) if $StringLenght= $aArray[$i] Then $FileSplit= StringSplit($File,".") $Time=FileGetTime ( $File ,$TimeOption ,0 ) If @error Then ExitLoop FileMove($path & $File, $path & $FileSplit & $Time & $Time & $Time & $aArray[$i], 0) Else ExitLoop EndIf WEnd FileClose($search01) next Ini file looks like:
[General] ;Enter folder where the files are located: ;Example C:\test\ InputFolder=C:\FileRename\ ;Enter the option you want to use, for timestamp ;0 = Last modified (default) ;1 = Created ;2 = Last accessed TimeOption=0 ;Enter Files extensions that needs a timestamp. ;FileExtention=FileNameLenght (characters) ;Example .TRX.MAU (Dont forget the leading point) ;FileNameLenght = how many characters the filename contains. Including "." ;If filename is longer or shorter it wil not rename the file. ;Example TR150730.TRX.MAU = 16 characters. [EXT] .txt=8 .log=8