Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

document write from txt file into page???

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

document write from txt file into page???

Post by ace2 »

I've been playing around with this, i echo the time into a text file and add to document.write to put it into the site.
It's a little messy what i'm doing, so i'm trying to fix it up a little...
So to explain, my camera switches on and echos the time to lapseon.txt using the CMD below

Code: Select all

if %Hour%==0 set "Hour=12"
set "Allm=%Hour%.%Min%"
echo document.write('%Allm% AM');> lapseon.txt
(manually having to add the AM/PM stamp)
this outputs like this in the text file

Code: Select all

document.write('8.20 AM');
On the web site i add this

Code: Select all

<script type="text/javascript" src="lapseon.txt"></script></abbr></td>
Now i can't find a simple command to output time with AM/PM but I found a powershell method that does it, but only the time to file.

Code: Select all

$a.ToShortTimeString() > C:\Cumulus\lapseon.txt
which gives 2:25 PM (as an example)

Does anyone have a method to add the contains of a txt file into website????
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: document write from txt file into page???

Post by sfws »

In pure HTML e.g.

Code: Select all

<object data="filename.txt" type="text/plain" width="150" height="8">
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: document write from txt file into page???

Post by ace2 »

sfws wrote:In pure HTML e.g.

Code: Select all

<object data="filename.txt" type="text/plain" width="150" height="8">
I should have added, to go into a table.
http://www.users.on.net/~ace2/status.htm
So not sure that code would work....
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: document write from txt file into page???

Post by ace2 »

No one has a solution???

What about it in cmd show time as 12 hour format with am/pm, then I could echo that to the text file like I'm doing...
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: document write from txt file into page???

Post by ace2 »

the powershell command is in fact

Code: Select all

$a = Get-Date
$a.ToShortTimeString()
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: document write from txt file into page???

Post by ace2 »

Well, i haven't found a better solution to adding a raw txt file into page with out using frames or attempting to resize into a table.
My basic cmd echo to file was ok, but, now i've mixed some powershell into it to write the txt with the difference the AM PM is not manually written.

Code: Select all

$a = Get-Date
$Docu = "document.write('"
$time = $a.ToShortTimeString()
$docend = "');"
$docu + $time + $docend | Out-File C:\Cumulus\scripts\lapseresult.txt
outputs

Code: Select all

document.write('8.10 PM');
to the txt file....

crude but works.....
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
Post Reply