AutoIt Forums: Folder sifter - AutoIt Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Folder sifter

#1 User is offline   AceSentinal 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 12
  • Joined: 31-July 09
  • Gender:Male

Posted 04 November 2009 - 01:03 AM

I am looking for a method to select folders and files alike for a File list compilation with the *.dec extension. Here is what I have, I'm pretty sure my problem is with "FileOpenDialog" however I don't know what to put in it's place.



[ autoIt ]    ( ExpandCollapse - Popup )
Case $Compile             $var=FileOpenDialog("Hold down Ctrl or Shift to choose multiple files.","Decks\","Apprentice Decks (*.dec)",1+4);Allows selection of files, Stored to string $var.             If @error Then                 MsgBox(4096,"","No File(s) chosen");Message box when cancel is clicked.                 Exit             Else                 $var=StringReplace($var,"|",@CRLF);String->Array function                 MsgBox(4096,"Files","You chose " & $var);String->Array Display             EndIf             $attrib = FileGetAttrib($var)             If @error Then                 MsgBox(4096,"Error", "Could not obtain attributes.")                 Exit             Else                 If StringInStr($attrib, "D") Then;Checks if file selected is a folder.(Auto search function)                     FileChangeDir($var)                     $search=FileFindFirstFile("*.dec"); Catches the first file in search.                     $Dir=stringreplace(@WorkingDir,@ScriptDir,"");gets local folder directory if in same folder as working script, or gets full path of deck                     While 1                         $file=FileFindNextFile($search);Search for subsequent files                         If @error Then ExitLoop;end loop when no more files are found                         $file=StringReplace($file,".dec","");remove .dec extension                         IniWrite("result.ini","Custom Deck",$file,$Dir);writes list to ini with the local folder name shortcut.                     WEnd                 EndIf             EndIf             If StringInStr($attrib, "N") Then;Checks if file selected is a normal file.(Auto search function)                 $search=FileFindFirstFile("*.dec"); Catches the first file in search.                 $Dir=stringreplace(@WorkingDir,@ScriptDir,"");gets local folder directory if in same folder as working script, or gets full path of deck                 While 1                     $file=FileFindNextFile($search);Search for subsequent files                     If @error Then ExitLoop;end loop when no more files are found                     $file=StringReplace($file,".dec","");remove .dec extension                     IniWrite(@ScriptDir&"result.ini","Custom Deck",$file,$Dir);writes list to ini with the local folder name shortcut.                 WEnd             EndIf             MsgBox(0, "Notice", "You will need to restart MTG Deck Viewer in order for the deck list to refresh.")             FileClose($search); Close the search handle

Edit:Forgot the color (code->autoit)

This post has been edited by AceSentinal: 04 November 2009 - 01:06 AM

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users