Jump to content

Search the Community

Showing results for tags '.txt'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 5 results

  1. Hello Everyone, I am very green when it comes to AutoIT, I have recently started using it to automate a job that i perform using MS Excel and that is working great. Recently I have been faced with a challenge I which i need to copy a specific set of lines from one .txt file and past them, overwriting a specific set of lines in a different .txt file. I honestly have no clue how I can copy the specified lines and transfer them. What functions / commands could I use and how could I lay them out I AutoIT? Any and all help will be appreciated. Thanks! Kruxe
  2. Good evening everyone I'm working on this little project for a week, and, what I'm trying to do could be useful for many users as well... I'm trying to do a "Report Generator", which reads the data that have to report from a text file (.txt) formatted with this pattern; Data1;Data2;Data3;Data4;Data5;; YES, there are 2 semi-colon at the end of the line. In detail, Data1 is a date/time stamp with this format: YYYY/MM/DD HH:MM:SS ; When the script starts, the user is prompted to choose 2 dates which I'll call as: Report_Date_Start; Report_Date_Start. So, the report, should cover all dates between Report_Date_Start AND Report_Date_End. And, already at this point, I don't know how to do the query... How can I say to the script: SELECT * FROM (.txt) WHERE Data1 BETWEEN Report_Date_Start AND Report_Date_End; ? I thought that I could do a _DateDiff, but if the difference between the two dates is months and not days, how can I do the trick? Should I make a Switch...Case with the _DateDiff() and see then calculate all the dates between Report_Date_Start AND Report_Date_End... But then, how can I compare the dates in the file with all the dates between Report_Date_Start AND Report_Date_End? I'm going crazy, I know... I've already made a "Export Tool", which exports the content of the .txt file in a .db, managed with SQLite... I mean, there I could easily do a query like I did above the thread, but, this "export", for 1080 rows, takes 28 seconds to be done. And, 1080 rows are daily rows that are added every day in the .txt file, so, in a week, the file could be easily 7000+ rows, which means that the "export" would take 3 minutes to be done... And we can go over and over... I'll post just for be "complete" what I've done about the export, so, maybe, someone could say how to improve it in terms of efficency... Local $aContenutoFileAuditReport = "" _FileReadToArray($sFileAudit_Report, $aContenutoFileAuditReport) If(IsArray($aContenutoFileAuditReport) And Not @error) Then Local $aContenutoFileAuditReport_Splitted = "" Local $sQuery = "" Local $hInizioConteggio = TimerInit() For $i = 1 To UBound($aContenutoFileAuditReport) - 1 $aContenutoFileAuditReport_Splitted = StringSplit($aContenutoFileAuditReport[$i], ";") $sQuery = "INSERT INTO FileDB_Report(DATESTAMP, TIMESTAMP, USER_ID, OBJECT_ID, DESCRIPTION, COMMENT) " & _ "VALUES(" & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[0]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[1]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[3]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[4]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[5]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[6]) & ");" If(_SQLite_Exec($hFileDB_Report, $sQuery) <> $SQLITE_OK) Then ConsoleWrite("Errore durante l'esecuzione della query #" & $i & @CRLF) Else ConsoleWrite("Query eseguita correttamente #" & $i & @CRLF) EndIf Next ConsoleWrite("Esportazione completata in: " & Round(TimerDiff($hInizioConteggio)/1000, 0) & " secondi") Else MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura del file nell'array." & @CRLF & "Errore: " & @error) EndIf I know that I can't do queries from a .txt file... [19:18] I've been writing this post from 18:40 maybe... By the way, if @jchd or someone else could tell me if I can import a formatted .txt file in SQLite and then, do queries on the DB, I'd be very happy for that... About the report in PDF, I'm talking with @taietel in order to know how to create a PDF. I hope someone will help me Sorry for the "long" list of questions... Thank you for everything you've done for me I have to say that this is the community of programming language that I've loved most! By the way, I'll be back tomorrow in the morning ( ~ 9:15 a.m. Italian time ), so, excuse me if I can't answer before that time. Hope you guys have a wonderful day/night. Thanks again Francesco
  3. Hi All, I'm not too code savvy but I know this is a simple one! Here's my problem, I have a folder with text files containing gcode. they are appended .nc, .ngc, and .gcode randomly. I can rename them all .ngc which is my preferred file type. In these files there's lines of gcode, carrying commands for a CNC. What I need to do is remove some comments from the beginning and format the text a certain way. I'll show an example of the original file and what I need it to look like. The files can be 20 lines or 10,000 long depending on the part. Old text: ( Header 1 text ) ( Header 2 text ) G90 (set absolute distance mode) G90.1 (set absolute distance mode for arc centers) G17 (set active plane to XY) G21 (set units to mm) #<z_safe> = 0.250 #<plunge_feed> = 5 (---------------------------------------------------------) G0 X 17.2644 Y 1.6127 M03 G1 X 2.2842 Y 8.0674 F 0.01 G1 X 15.3642 Y 17.8133 G1 X 17.2644 Y 1.6127 M05 G0 X 0.0000 Y 0.0000 M05 M02 What it needs to look like: G90 G21 G0 X17.2644 Y1.6127 M03 G1 X2.2842 Y8.0674 <--- copy and paste above the next m05 G1 X15.3642 Y17.8133 G1 X17.2644 Y1.6127 G1 X2.2842 Y8.0674 <--- pasted here M05 G0 X0.000 Y0.000 M05 M02 Some things to note: g90 sets absolute coordinate mode, g21 tets units to mm, g0 is first coordinate to move the tool to. This is an important step: m03 is what turns on a laser. I need the first coordinate after every m03 to be copied to the line above m05 for each chunk of gcode. the very last m05 before the m02 needs to be ignored. There are multiple chunks with m03 x,ys then m05. each chunk is going to have different coordinates after the m03. I have no idea where to start other than find the line with the wanted string, m03. dont know how to handle m05 though... any help is very much appreciated!
  4. I'm trying to write a test .txt file with test being the word I want to put into the GUI window. Kinda stuck any help would be appreciated. (work in progress) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Global $file = FileOpen("test.txt") GUICreate("Disclaimer", 500, 400) ;Creates the GUI window fileread($file, 400) GUISetState(@SW_SHOW) ;Shows the GUI window sleep(5000) fileclose($file)
  5. Hey guys, I have been trying to make a script which requests some information and writes it to a notepad file after the information is entered... The whole script runs smoothly (variables, etc) except for the opening of the file/writing to the file.. I have tried Run and FileWriteLine, both with the same results... Was hoping that you could help me on this one (I need this done soon... its a bit important, thanks) Thanks for any feedback and help I have put the script below ; Project: input hours ;means - notepad tracker? If 2 = MsgBox (1,"TimeTracker","Welcome, would you like to begin?") then Exit ;vars $date = InputBox ("TimeTracker","Input date and day"&@CRLF&"format [DAY] - [DATE]") $phys = InputBox ("TimeTracker","Input hours done of Physics") $chem = InputBox ("TimeTracker","Input hours done of Chemistry") $math = InputBox ("TimeTracker","Input hours done of Math") $file = FileOpen ("G:\StudyHours.txt",1) if $file = 1 Then FileWriteLine ("G:\StudyHours.txt",@CRLF&@CRLF&$date&@CRLF&$phys&@CRLF&$chem&@CRLF&$math) MsgBox (0,"TimeTracker","Done! :D") ElseIf $file = 0 Then MsgBox (0,"TimeTracker","Sorry, file not found @_@") EndIf Exit (The error in this case occurred at the file open, it said that it could not either open the file, or find it...)
×
×
  • Create New...