Freshprince Posted February 9, 2010 Share Posted February 9, 2010 Hey everyone!Iam working on a projectit should do the following:- Clear a directory && download some content (works)- After this, it should open a programm and the following ones,have to wait (works)- A search has to be done,for a specific directory,if there are no datas,there comes a massage box with" no datas in here" , or when datas there,a batch runs .my code is this#include <string.au3>#include <array.au3>#include <file.au3>$SearchDir="M:\AUTO_JOB\ALK_Daten\Tab" $SearchFiles= "*.DAT" $SearchFiles= "*.MAP"$SearchFiles= "*.IND"$SearchFiles= "*.ID"DirRemove("M:\AUTO_JOB\Tab") InetGet("ftp:andsoon...", "AL001_001_0000_00_GF_TB.prj",1) Sleep(1000)DirCreate("M:\AUTO_JOB\Tab")ShellExecuteWait("M:\AUTO_JOB\Programm") $FolderList=_FileListToArray($SearchDir & "M:\AUTO_JOB\Tab", $Searchfiles,1) If (Not IsArray($FolderList)) then MsgBox(0,"No Data in here",1)ELSE Run("M:\AUTO_JOB\Batch.bat") EndIf EndIfI would be very very happy if someone could help me with that,im tryin for hours /and nothing goes:(and one question to it :i know with Inetget you can download ,i can do it with one data..Does it works with adirectory??Thank you,to everyone who helps me:) Link to comment Share on other sites More sharing options...
JohnOne Posted February 9, 2010 Share Posted February 9, 2010 Not sure what your script is doing but you have an extra EndIf, and declaring the same variable name for 4 different strings. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 Freshprince,You cannot look for more than one file type at a time with _FileListToArray, so you need to loop through the 4 options like this:#include <string.au3> #include <array.au3> #include <file.au3> $SearchDir="M:\AUTO_JOB\ALK_Daten\Tab" ; create an array to hold the file types (you can only use one at a time) Global $SearchFiles[4] $SearchFiles[0]= "*.DAT" $SearchFiles[1]= "*.MAP" $SearchFiles[2]= "*.IND" $SearchFiles[3]= "*.ID" DirRemove("M:\AUTO_JOB\Tab") InetGet("ftp:andsoon...", "AL001_001_0000_00_GF_TB.prj",1) Sleep(1000) DirCreate("M:\AUTO_JOB\Tab") ShellExecuteWait("M:\AUTO_JOB\Programm") ; Now look for the file types we listed earlier ; Set a flag to see if files were present $fFlag = False For $i = 0 To 3 ; Move through the array looking for each type in turn $FolderList=_FileListToArray($SearchDir & "M:\AUTO_JOB\Tab", $Searchfiles[$i],1) ; If we find some files than set the flag) If IsArray($FolderList) Then $fFlag = True Next ; If we found files then run your batch file If $fFlag = True Then Run("M:\AUTO_JOB\Batch.bat") ; If not Else MsgBox(0,"No Data in here",1) EndIfI hope this helps. Please ask if anything is unclear. M23P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Freshprince Posted February 10, 2010 Author Share Posted February 10, 2010 Hey! First i wanna thanks for the Script you postet! And i`ve got questions:) So,i tried it,but it comes always the Messagebox with" No data in here" ,even when i have datas in the tab directory i just made a data with the search function and if datas the batch should run... in the line " $FolderList=_FileListToArray($SearchDir & "M:\AUTO_JOB\ALK_Daten\Tab", $Searchfiles[$i],1)" i made $SearchFiles so a big F..But that wasnt the point.. so what could be the problem? Link to comment Share on other sites More sharing options...
martin Posted February 10, 2010 Share Posted February 10, 2010 Hey! First i wanna thanks for the Script you postet! And i`ve got questions:) So,i tried it,but it comes always the Messagebox with" No data in here" ,even when i have datas in the tab directory i just made a data with the search function and if datas the batch should run... in the line " $FolderList=_FileListToArray($SearchDir & "M:\AUTO_JOB\ALK_Daten\Tab", $Searchfiles[$i],1)" i made $SearchFiles so a big F..But that wasnt the point.. so what could be the problem? Psst, post some code, I happen to know that Melba23 is having trouble charging the batteries for his crystal ball. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Freshprince Posted February 10, 2010 Author Share Posted February 10, 2010 That was my original script it should 1.remove a directory ,load a project data create a directory and open a programm which works and after that the other programs begin..so far it worked all.. 2. BUT the next step is,a directory should been searched after the 4 diffrent datatypes,and then,if there are datas in the directory a batch should been startet,or when no datas in a msg box should open and say "no datas in here. #include <string.au3> #include <array.au3> #include <file.au3> $SearchDir="M:\AUTO_JOB\ALK_Daten\Tab" $SearchFiles= "*.DAT" $SearchFiles= "*.MAP" $SearchFiles= "*.IND" $SearchFiles= "*.ID" DirRemove("M:\AUTO_JOB\Tab") InetGet("ftp:andsoon...", "AL001_001_0000_00_GF_TB.prj",1) Sleep(1000) DirCreate("M:\AUTO_JOB\Tab") ShellExecuteWait("M:\AUTO_JOB\Programm") $FolderList=_FileListToArray($SearchDir & "M:\AUTO_JOB\Tab", $Searchfiles,1) If (Not IsArray($FolderList)) then MsgBox(0,"No Data in here",1) ELSE Run("M:\AUTO_JOB\Batch.bat") EndIf EndIf Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 10, 2010 Moderators Share Posted February 10, 2010 Freshprince,The error is in your _FileListToArray($SearchDir & "M:\AUTO_JOB\Tab", $Searchfiles,1) line.I did not notice last night that you are giving 2 paths to search - just like the filenames, you can only do one at a time! Do you actually want to search both the paths or just one? This is what it would look like if you wanted to search both:For $i = 0 To 3 ; Move through the array looking for each type in turn ; Look in the $SearchDir folder $FolderList=_FileListToArray($SearchDir, $Searchfiles[$i],1) ; If we find some files than set the flag) If IsArray($FolderList) Then $fFlag = True ; Look in the M:\AUTO_JOB\Tab folder $FolderList=_FileListToArray("M:\AUTO_JOB\Tab", $Searchfiles[$i],1) ; If we find some files than set the flag) If IsArray($FolderList) Then $fFlag = True NextIf you only need to search one of the folders, just delete the section which looks in the other. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Freshprince Posted February 10, 2010 Author Share Posted February 10, 2010 Hey! I thank you very much for that help. More important i also understand what my fault was. Very pleased about the help,thanks to everybody! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now