Jump to content

Recommended Posts

Hello everyone.

I need help with scripts. I have some code which creates array, and next writes this array to a file (function _FileWriteFromArray).

In the next step it creates second array. I would like to add this array to previous file, but function _FileWriteFromArray repleaces only content in the file.
Is there any other way to solve this problem?

Link to post
Share on other sites
  • Moderators

blantek212,

Do not forget to close the file handle when you have written the last array.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites
  • 2 weeks later...

I'm not sure what _FileWriteFromArray does, but the simplest thing you can do is something like this:

$file = FileOpen("FILENAME.txt", 1)

For Local $i = 0 To $array1Size
    FileWrite($file, $array1[$i], " ") ;Log to file.
Next

FileWrite($file, @CRLF) ;Newline.

For Local $i = 0 To $array2Size
    FileWrite($file, $array2[$i], " ") ;Log to file.
Next

FileWrite($file, @CRLF) ;Newline.

;Etc...

FileClose($file)

 

Link to post
Share on other sites
  • Moderators

Pured,

Quote

I'm not sure what _FileWriteFromArray does

Then I suggest opening the Help file and reading about the function rather then making inane and unhelpful comments like the above.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By johnmcloud
      Hi guys, i have made this script:


      $File = _RecFileListToArray("C:\Test", "*.*", 1, 0, 0, 2, "", "") If IsArray($File) Then For $i = 1 To $File[0] $Time = FileGetTime($File[$i]) $dmyyyy = $Time[2] & "/" & $Time[1] & "/" & $Time[0] MsgBox(0,"FileDate", $File[$i] & " - " & $dmyyyy) Next EndIf
      The script working with MsgBox, so i have try to write the result on a txt like this:


      $ToWrite = $File[$i] & " - " & $dmyyyy $Log = @TempDir & "\log.txt" $LogCreate = FileOpen(@TempDir & "\log.txt", 1) _FileWriteFromArray($LogCreate, $ToWrite) FileClose($LogCreate)
      But not working, i have only the filename but not the date. What is the problem?
      Thanks for support
×
×
  • Create New...