Author Topic: Text to file function appends instead of replace  (Read 6951 times)

omega9380

  • Guest
Text to file function appends instead of replace
« on: November 30, 2016, 02:39:34 AM »
I would like to request an update to the Write Text to File command.  I was wondering if it could append to an existing file instead of replacing it.  I am running EDDI with Elite Dangerous and am trying to come up with an alternate way of seeing the info EDDI sends out.  The TTS feature is nice, but when I am doing trade runs or out exploring, I turn off the sound to ED and VA so I can watch Netflix or Youtube.  I am setting up VA commands to send the EDDI info to the log, but being able to write it to an updating text file that is watched by a TAIL like log utility would be ideal, and VA can do it if it appends to an existing file instead of overwriting it.  Thanks!!

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Text to file function appends instead of replace
« Reply #1 on: November 30, 2016, 09:47:08 AM »
Yikes... the intent was to add that, but it was just forgotten.  I'll see if that can be popped in without too much trouble ;)

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Text to file function appends instead of replace
« Reply #2 on: November 30, 2016, 07:27:39 PM »
I tossed that one on there real quick... you can get it in the, 'unofficial' bin if you want it: http://www.voiceattack.com/unofficial

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Text to file function appends instead of replace
« Reply #3 on: December 01, 2016, 06:23:45 AM »
This is awesome! The only problem is, I just created a workaround to do something like this. haha Now, I don't need the workaround. :)

omega9380

  • Guest
Re: Text to file function appends instead of replace
« Reply #4 on: December 01, 2016, 03:13:15 PM »
Thanks, that's exactly what I needed!

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Text to file function appends instead of replace
« Reply #5 on: December 05, 2016, 04:27:36 AM »
This is awesome! The only problem is, I just created a workaround to do something like this. haha Now, I don't need the workaround. :)

Omega9380 pointed me in this direction as I was lookign for the same kind of thing to do with writting txt files

One thing I wanted to also ask with this command is it possible to not Append but Add the new data to the top of the txt file its appending too also a way to limit the amount of lines in the text file?

Basically trying to make a script for EDDI that writes my last 5 jumps to a txt file to be used my OBS when I'm exploring.

I'm no programmer or script writer but I'm trying to do my own scripts when and where I can. Love VA and EDDI with its scripting and really enjoy it when i can get it working that is.

--
CMDR Bumble B รถ7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Text to file function appends instead of replace
« Reply #6 on: December 05, 2016, 05:23:41 PM »
I made a command in VA that copies the last 10 CTRL+C to a file. When it gets to the 11th, it overwrites the file. Maybe it will help you out.

Code: [Select]
Set small int (condition) [Last 10] value as incremented by 1
Begin Small Integer Compare : [Last 10] Has Not Been Set
    Set small int (condition) [Last 10] value to 1
End Condition
Begin Small Integer Compare : [Last 10] Equals 1
    Press and release Left Ctrl+C keys
    Write (overwrite), '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 2
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 3
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 4
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 5
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 6
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 7
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 8
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 9
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met
Begin Small Integer Compare : [Last 10] Equals 10
    Set small int (condition) [Last 10] value to 0
    Press and release Left Ctrl+C keys
    Append, '{CLIP}' to file 'C:\Program Files (x86)\VoiceAttack Beta\Apps\Last 10 Clipboard History\Buffer.txt'
End Condition - Exit when condition met


Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Text to file function appends instead of replace
« Reply #7 on: December 05, 2016, 09:21:43 PM »
Way cool :)