nht3004 Posted May 3, 2009 Posted May 3, 2009 (edited) I have these codes: $importData1=FileRead("temp.txt"); MsgBox(0,"",$importData1); $file1=FileOpen("data1.txt", 2); FileWrite($file1, $importData1); FileClose($file1) $importData2=FileRead("D:\Temp.txt");importData1 is different from importData2! MsgBox(0,"",$importData2); $file2=FileOpen("data2.txt", 2); FileWrite($file2, $importData2); FileClose($file2) When I run the script, both of them show the data inside file temp.txt and D:\Temp.txt but only $importData1 is written to data1.txt and $importData2 is not. The only difference between 2 codes is FileRead("temp.txt"); and FileRead("D:\Temp.txt") (Path) so I think the problem about the same directory. Fix for me plz! Edited May 3, 2009 by nht3004 for(loop=0; loop<infinity; loop++) { alert('I love you'); }
Aceguy Posted May 3, 2009 Posted May 3, 2009 (edited) so your merging one file with another.? look @ _filereadtoarray and _filewritefromarray in the helpfile. Edited May 3, 2009 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock
BrettF Posted May 3, 2009 Posted May 3, 2009 Look very closly at the FileOpen lines... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
nht3004 Posted May 3, 2009 Author Posted May 3, 2009 so your merging one file with another.?look @ _filereadtoarray and _filewritefromarray in the helpfile.Two files to write and read are totally different, how can I merge them bro, I still can't get it! for(loop=0; loop<infinity; loop++) { alert('I love you'); }
nht3004 Posted May 3, 2009 Author Posted May 3, 2009 Look very closly at the FileOpen lines... I've looked @ the code all this afternoon! I still can't find errors! for(loop=0; loop<infinity; loop++) { alert('I love you'); }
Moderators Melba23 Posted May 3, 2009 Moderators Posted May 3, 2009 nht3004, The lines are not wrong, but they do not do what you want them to do! You have a logic problem, not a coding one. From your first post: $file1=FileOpen("data1.txt", 2)= Open a file called "data1.txt" and delete any existing file of that name. $file2=FileOpen("data2.txt", 2)= Open a file called "data2.txt" and delete any existing file of that name. So you will get 2 files: "data1.txt" which is a copy of "temp.txt", and "data2.txt" which is a copy of "D:\Temp.txt". If you want to merge them you need to open the same file twice - and use the "append" rather than the "delete" flag:$importData1=FileRead(@ScriptDir & "\temp.txt"); MsgBox(0,"",$importData1); $file1=FileOpen(@ScriptDir & "\data1.txt", 2) ; Open file and delete existing file FileWrite($file1, $importData1) ; Write to file FileClose($file1) $importData2=FileRead"D:\Temp.txt") MsgBox(0,"",$importData2); $file1=FileOpen("\data1.txt", 1) ; Open the same file for append to contents FileWrite($file1, $importData2) ; Append to existing file FileClose($file1) 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
CodyBarrett Posted May 3, 2009 Posted May 3, 2009 welll.. it KINDA is a coding problem.. although those flags are in the help file [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
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