AutoHotkey Community

It is currently May 27th, 2012, 9:25 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: August 21st, 2006, 6:40 pm 
Offline

Joined: August 20th, 2006, 11:44 pm
Posts: 29
Location: Ottawa
I manage database and sometimes customer provide their shipping information in a TXT file and the data is not arrange to import in Access. All data is in 1 line.

Made this little macro to re-align all the data to be able to import in Access or Excel. You have to specify what to search for, in this exemple I search for "5,h,"

Here is an exemple of file that is given to me You will see that once the file is completed that all fields are align, it beats doing it manually heheheh

5,H,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,1,23232323000096235,967,3665,0,0,0,0,0,44348 Rue Bdfnnière, App. 301, ,Montréal,PQ,H1X2M4,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,haksdana_jesde@yasdo.com,0,0,0, ASTRID BICAsdPAKA SHEMA,5sdsdsds983,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,2,23232323000096242,967,3855,0,0,0,0,0,10395 Rancourt,,montréal,QC,H2B2P2,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,louise.quesdnsdlle@gsdorex.ca,0,0,0, MARsdLIPPE TÉsdAULT,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,3,23232323000096259,967,3940,0,0,0,0,0,449 Bourbonnais,,LaSalle,QC,H8R2Z2,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,e.gausdn@videsddn.ca,0,0,0,STÉPHANIE GAUDRON,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,4,23232323000096266,967,3005,0,0,,10395 Rancourt,,montréal,QC,H2B2P2,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,lousde.qudsdille@gesconsdrex.ca,0,0,0, Lsd-MAUDE TÉTREsdLT,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,5,23232323000096273,967,2580,0,0,0,0,0,787 13e avenue,,Lachine,QC,H8S3K4,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,pepito1@videosdn.ca,0,0,0,VANsdSSA PsdIN,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,6,23232323000096280,967,3290,0,0,0,0,0,33 Mérineau,,Kirkland,QC,H9J3V8,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,d.dusdois@ssss.gsdsd.ca,0,0,0,GsdEVIsdE BOsdARD,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,7,23232323000096297,967,5665,0,0,0,0,0,3625 dfdfdfdfdfdf,,Trois-Rivières,QC,G9B2B6,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.csdm,,,0,0,0,Jsd-PHILsdPEsdERS,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,8,23232323000096303,967,2000,0,0,0,0,0,231 place pedfdfn,,Yamacdfdfhe,QC,G0X3L0,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,cmsdin_19@symsdico.ca,0,0,0,ANTsdNE BOURAsdA,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,9,23232323000096310,967,2615,0,0,0,0,0,7925 Boul Gouin ,,Montreal,QC,H1E2A2,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,,0,0,0,sdsd-Ève Duchesne,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,10,23232323000096327,967,760,0,0,0,0,0,11775 Boul. Bécancour,,Bécancour,QC,G9H2K1,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,,0,0,0,AUDREY HÉLIE,,,,,,,0,5,h,5,10912,I086,F2423423434208,Matériel Scolaire,06082006,23232323,23232323,0,0,0,0,11,23232323000096334,967,1680,0,0,0,0,0,1291 Foch,,Verdun,QC,H4H2R4,CA,0.00,0.00,0,0.00,0,1,0,0,0,0.00,1,0,0,0,0,0,1,0,0,0,weeuf@gvwec.com,,chsdvinmc@hosdail.com,0,0,0,GENEVsdE CADIEUX,,,,,,,0,

_________________
There is always something new to learn.
_________________
http://autohotkey.net/~Fabiolus/


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Here is the code
PostPosted: August 21st, 2006, 6:40 pm 
Offline

Joined: August 20th, 2006, 11:44 pm
Posts: 29
Location: Ottawa
See post below for snippet

_________________
There is always something new to learn.
_________________
http://autohotkey.net/~Fabiolus/


Last edited by Fabiolus on August 29th, 2006, 2:01 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 22nd, 2006, 8:54 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
It seems (mostly from a previous post in the Ask for Help section) that you are using Notepad to do your text processing.
This is very ineficient, you should use the built-in good string processing facilities of AutoHotkey.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: PhiLho
PostPosted: August 22nd, 2006, 2:19 pm 
Offline

Joined: August 20th, 2006, 11:44 pm
Posts: 29
Location: Ottawa
Not sure about the built in string thing you mention, I will be looking into that for sure.

I just started using AHK and find it very interesting.

I ended up with this version to complete my task.

Feel free to add your version if you wish.

**************************************************

FileRead, MyFileContent, MyFile.txt
FileSelectFile, SelectedFile, 1, , Open a file, Text Documents (*.txt; *.cp1)
if ErrorLevel
ExitApp

Run, %SelectedFile%
Sleep, 1000

msgbox, 64, Fabiolus File Fixer Version 6, Press ESCAPE to cancel job in progress

InputBox, UserInput,, Enter what to search for.
if ErrorLevel
ExitApp
Send {F3}
GoSub, CheckIfFound
sleep, 10 ;add more sleep for slower computer
send %UserInput%
Send {Enter}
Send {Enter}
Send {Esc}
Send {Enter}
Send %UserInput%

Loop
{
Send {F3}
GoSub, CheckIfFound
sleep, 10 ;add more sleep for slower computer
Send {Enter}
Send %UserInput%


If GetKeyState( "Esc", "P" )
Break
}

;*************Subroutines**************
CheckIfFound:
IfWinActive, , Cannot find ; Will appear if search criteria is not found
{
Sleep 10
Send {Enter} ; Closes Find dialog box
MsgBox, 64, Fabiolus File Fixer Version 6, File Done !!!!`n`nNow simply save your file.
ExitApp
}
Return

_________________
There is always something new to learn.
_________________
http://autohotkey.net/~Fabiolus/


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], nomissenrojb, SKAN, Stigg and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group