Appie78 Posted July 14, 2009 Posted July 14, 2009 Hi Guys, I've got a little problem with the Filewrite(). Below code isn't working, it does create the file and the Filewrite return a "Succes" in the Msgbox. Func Begin() $FileLog = FileOpen("C:\Images\" & $Begin & "\" & $Begin & "(" & @MDAY & "-" & @MON & "-" & @YEAR & ")" & ".log", 9) If $FileLog = -1 Then MsgBox(0, "Error", "Unable to open logfile.") Return EndIf If Not $Stub = 1 Then FileWrite($FileLog, @CRLF) EndIf $line = FileWrite($FileLog, "Started: " & @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF) MsgBox(0, "", $line) EndFunc ;==>Begin Func Eind() FileWrite($FileLog, "Reference number:Stub" & @CRLF) FileWrite($FileLog, "Ammount of fields observed: " & $StepCount & @CRLF) FileWrite($FileLog, "Ammount of fibres counted: " & $Vezel & @CRLF) FileWrite($FileLog, "Ammount of pictures taken: " & $Number - 1 & @CRLF) FileWrite($FileLog, "Finished: " & @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF) FileClose($FileLog) EndFunc ;==>Eind Anyone who can help me out? Thanks Electron microscopes rule!!!
Yashied Posted July 14, 2009 Posted July 14, 2009 Works good for me, the file is created. The only problem might be with $Begin. What is it? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Appie78 Posted July 14, 2009 Author Posted July 14, 2009 Works good for me, the file is created. The only problem might be with $Begin. What is it? Hi Yashied, $Begin = $Array[$i][$i] Also tested this with a Msgbox which returns me the correct data. The file is created when I run the script, but all the lines from the two functions don't get written into the file. Thanks, Appie Electron microscopes rule!!!
Yashied Posted July 14, 2009 Posted July 14, 2009 (edited) The problem may be only with $Begin. Post a ready to run part of your code.EDIT: Appie78, but you do not accidentally lost $FileLog? Edited July 14, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
DYONISII Posted July 14, 2009 Posted July 14, 2009 (edited) hmmm... Begin() doesn't call Eind(). how about this: If Not $Stub = 1 Then FileWrite($FileLog, @CRLF) ;<<--- should be changed to Eind() EndIf Edited July 14, 2009 by DYONISII http://dev.dyonisii.com/
Appie78 Posted July 14, 2009 Author Posted July 14, 2009 hmmm... Begin() doesn't call Eind(). how about this: If Not $Stub = 1 Then FileWrite($FileLog, @CRLF) ;<<--- should be changed to Eind() EndIf Hi DYONISII, Both functions are called from another function, so both get called but not after eachother. Thanks for the reply @Yashied, I'll try and sort some things out tonight. Thanks, Appie Electron microscopes rule!!!
Appie78 Posted July 15, 2009 Author Posted July 15, 2009 Hi all, It's like a miracle happened, it's working now!!!! The only thing that worries me is that I didn't change anything in my code. The only thing is that I put my laptop to hibernate twice! Well anyway thanks for the help. Appie Electron microscopes rule!!!
DYONISII Posted July 15, 2009 Posted July 15, 2009 perhaps you started talking to your computer. LOL! a long time ago when i used to teach, a student was in a situation like yours. he asked me what was the error of his program because he was receiving an error message. i looked at it and didn't find anything wrong. then i ran it myself, and it did properly. oh well, sometimes, you gotta be nicer to your puter. they behave better if you treat them as people too hehehe. http://dev.dyonisii.com/
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