StephenG Posted November 2, 2014 Share Posted November 2, 2014 I'm interested in breaking up a long text file into smaller ones - and found scripts under Split Text Files Speed Help (Forum - 3 Feb 2010). Both scripts by KeeWay and Melba23 apparently worked at the time. I changed the script by Melba23 so that my files are referenced (and the search string is relevant to my files) but this generates a 'subscript ...error' message at the line For $i = 1 To $FileArray[0] below, with a ^ below the [0]: #include <File.au3> Global $FileArray $file = @ScriptDir & "C:UsersStephenDesktopNew folderkahntextsel2.txt" $newfile = @ScriptDir & "C:UsersStephenDesktopNew foldersplit-" ; _FileReadToArray($file, $FileArray) $filecount = 0 $sNewFile_Text = "" ProgressOn("Processing SBT File", "Reading The File...", "0 Lines") For $i = 1 To $FileArray[0] SyntaxCheck Prod does not report any errors. I doubt it's significant - but the _FileReadToArray command is in colour in both example scripts, but not in my editor. I'm working with Windows 7 Professional SP1, 64 bit. (I'm a bit mystified by the #include, and have assumed that File.au3 is available with the download). I'd appreciate any pointers as to what I should do. Thank you. Stephen Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 2, 2014 Moderators Share Posted November 2, 2014 StephenG,Welcome to the AutoIt forums. The error is caused by you trying to access an array variable which is not actually an array - so it would appear that the function did not return one. You are correct that File.au3 is a standard include file - if the script could not find the file you would have other errors shown. I suggest you add a debugging line after the call to _FileReadToArray and see what error value is returned - that way we might get a better idea of why this is happening:_FileReadToArray($file, $FileArray) MsgBox(0, "Error", @error)Try that and post the value that you see in the MsgBox. 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...
StephenG Posted November 2, 2014 Author Share Posted November 2, 2014 Thanks very much. The error message was: 1 - which I discovered means the file cannot be found. So then I looked at the file path and name - - and eventually figured that the @ScriptDir meant that the .au3 file, and the file to be processed, had to be in the same folder/directory. Once I changed the file name from the full path, and put the .au3 file in the same folder - it worked! So thank you for your help. I needed a program like this a few years ago (to turn long text files with lots of records in into files with one record in - for further text analysis purposes) and gave up at that point. So this is great for me - it will help in my research. Having discovered AutoIt and recalling some Basic programming years ago, I might even try my hand now at writing other text processing routines. Stephen JohnOne 1 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