mrtweaver Posted July 20, 2015 Share Posted July 20, 2015 I am fairly new to this Autoit so i am looking for some help and guidance on how to get started on the following. I know what i want to do but just can not figure out how to do it.I have this file which is created by the USPS, it has variable amounts of padded spaces, for example it might have 7 spaces between the first and second columns, 21 spaces between the second and third, 16 spaces between the third and fourth. etc...Originally i had thought of using the stringstripwc with a value of 3 to strip all spaces over 2 characters, however with two of the files this will not work as they usually pad certain areas with anywhere between 2 to 4 spaces.So I am wondering is how it would be done within autoit that 5 spaces and over would be replaced with a certain character, anything under that amount would be left alone, then i could use that character as a column delimiter in my array.Any help or guidance greatly appreciated. Link to comment Share on other sites More sharing options...
mrtweaver Posted July 20, 2015 Author Share Posted July 20, 2015 I am fairly new to this Autoit so i am looking for some help and guidance on how to get started on the following. I know what i want to do but just can not figure out how to do it.I have this file which is created by the USPS, it has variable amounts of padded spaces, for example it might have 7 spaces between the first and second columns, 21 spaces between the second and third, 16 spaces between the third and fourth. etc...Originally i had thought of using the stringstripwc with a value of 3 to strip all spaces over 2 characters, however with two of the files this will not work as they usually pad certain areas with anywhere between 2 to 4 spaces.So I am wondering is how it would be done within autoit that 5 spaces and over would be replaced with a certain character, anything under that amount would be left alone, then i could use that character as a column delimiter in my array.Any help or guidance greatly appreciated. Link to comment Share on other sites More sharing options...
JohnOne Posted July 20, 2015 Share Posted July 20, 2015 StringRegExpReplace is the function you should look at. 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...
Developers Jos Posted July 20, 2015 Developers Share Posted July 20, 2015 Merged duplicate topic.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mikell Posted July 20, 2015 Share Posted July 20, 2015 JO, SRER is not so easy for a fairly new AutoIt user Just a clue$newtext = StringRegExpReplace($oldtext, '\h{5,}', $delimiter) JohnOne 1 Link to comment Share on other sites More sharing options...
JohnOne Posted July 20, 2015 Share Posted July 20, 2015 Or me Just a nudge is all. 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...
junkew Posted July 20, 2015 Share Posted July 20, 2015 Please share the first five lines of the file to make the question more clear with an example file. It.sounds like a fixed width file. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets 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