Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #590 > unrolled thread
| Started by | Roger Darlington <rogerarm@freeuk.com> |
|---|---|
| First post | 2011-08-12 08:46 +0100 |
| Last post | 2011-08-16 08:23 +0100 |
| Articles | 9 — 7 participants |
Back to article view | Back to comp.sys.acorn.programmer
A one-liner to save (any)file with the date as filename Roger Darlington <rogerarm@freeuk.com> - 2011-08-12 08:46 +0100
Re: A one-liner to save (any)file with the date as filename "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-08-12 10:31 +0200
Re: A one-liner to save (any)file with the date as filename "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-08-12 10:38 +0200
Re: A one-liner to save (any)file with the date as filename jgharston <jgh@arcade.demon.co.uk> - 2011-08-12 04:22 -0700
Re: A one-liner to save (any)file with the date as filename Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2011-08-13 02:51 +0100
Re: A one-liner to save (any)file with the date as filename Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-08-12 15:02 +0100
Re: A one-liner to save (any)file with the date as filename Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-08-13 01:03 +0200
Re: A one-liner to save (any)file with the date as filename druck <news@druck.org.uk> - 2011-08-13 15:06 +0100
Re: A one-liner to save (any)file with the date as filename Roger Darlington <rogerarm@freeuk.com> - 2011-08-16 08:23 +0100
| From | Roger Darlington <rogerarm@freeuk.com> |
|---|---|
| Date | 2011-08-12 08:46 +0100 |
| Subject | A one-liner to save (any)file with the date as filename |
| Message-ID | <d2b97e0152.rogerarm@rogerarm.freeuk.com> |
I want a simple one-liner to insert in the run-file of FTPc that will save a file (any file, one of zero length) that has the date and time as the filename of that file. This is just a simple way of showing me when I last ran FTPc. I can look inside the FTPc app and look at the filename and see when I last ran it. Any ideas? I thought of using Screensave"TimeLastRun" but then I would have to run the spritefile and look at both the date and the time on the iconbar. Is there a simple way of saving the date/time as a filename as a one-liner in a Run file? -- Cheers Roger I'm a mitochondriac
[toc] | [next] | [standalone]
| From | "John Williams (News)" <UCEbin@tiscali.co.uk> |
|---|---|
| Date | 2011-08-12 10:31 +0200 |
| Message-ID | <52ffffcda0UCEbin@tiscali.co.uk> |
| In reply to | #590 |
In article <d2b97e0152.rogerarm@rogerarm.freeuk.com>, Roger Darlington <rogerarm@freeuk.com> wrote: > This is just a simple way of showing me when I last ran FTPc. > I can look inside the FTPc app and look at the filename and see when I > last ran it. I assume you're running SysLog, so it should be quite easy to get it to keep a log for FTPc. There should be a simple line you could use - but I can't get it to work consistently here. Perhaps someone else can help with that. John -- John Williams, Brittany, Northern France - no attachments to these addresses! Non-RISC OS posters change user to johnrwilliams or put 'risc' in subject! Who is John Williams? http://petit.four.free.fr/picindex/author/
[toc] | [prev] | [next] | [standalone]
| From | "John Williams (News)" <UCEbin@tiscali.co.uk> |
|---|---|
| Date | 2011-08-12 10:38 +0200 |
| Message-ID | <52ffffcda5UCEbin@tiscali.co.uk> |
| In reply to | #591 |
On 12 Aug, UCEbin@tiscali.co.uk wrote:
> There should be a simple line you could use
The one I'm playing with is:
SysLog FTPc 100 Loaded
and it does seem to work now!
You should, tho', follow the instructions in the Help for SysLog and
RMEnsure etcetera as recommended.
So it's more than a one-liner!
John
--
John Williams, Brittany, Northern France - no attachments to these addresses!
Non-RISC OS posters change user to johnrwilliams or put 'risc' in subject!
Who is John Williams? http://petit.four.free.fr/picindex/author/
[toc] | [prev] | [next] | [standalone]
| From | jgharston <jgh@arcade.demon.co.uk> |
|---|---|
| Date | 2011-08-12 04:22 -0700 |
| Message-ID | <3b5bfae8-59cc-4846-b711-272a435e45f9@q1g2000vbj.googlegroups.com> |
| In reply to | #590 |
Roger Darlington wrote: > I want a simple one-liner to insert in the run-file of FTPc that will > save a file (any file, one of zero length) that has the date and time > as the filename of that file. I've always found the LEFT/MID/RIGHT functions of *Set hard to work out, so I tend to use something like this: REM > GetTime A$=TIME$ A$=MID$(A$,12,4)+MID$(A$,8,3)+MID$(A$,6,2)+MID$(A$,17,2)+MID$(A$, 20,2)+MID$(A$,23,2) OSCLI "Set Sys$TimeName "+A$ OSCLI "Set Sys$DateName "+LEFT$(A$,9) then in an Obey file use something like: /<path>GetTime Create <path><Sys$TimeName> 0 JGH
[toc] | [prev] | [next] | [standalone]
| From | Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> |
|---|---|
| Date | 2011-08-13 02:51 +0100 |
| Message-ID | <mpro.lpuftg007kdes02qk@wingsandbeaks.org.uk.invalid> |
| In reply to | #594 |
jgharston <jgh@arcade.demon.co.uk> wrote:
> Roger Darlington wrote:
> > I want a simple one-liner to insert in the run-file of FTPc that will
> > save a file (any file, one of zero length) that has the date and time
> > as the filename of that file.
>
> I've always found the LEFT/MID/RIGHT functions of *Set hard to work
> out, so I tend to use something like this:
>
> REM > GetTime
> A$=TIME$
> A$=MID$(A$,12,4)+MID$(A$,8,3)+MID$(A$,6,2)+MID$(A$,17,2)+MID$(A$,
> 20,2)+MID$(A$,23,2)
> OSCLI "Set Sys$TimeName "+A$
> OSCLI "Set Sys$DateName "+LEFT$(A$,9)
>
> then in an Obey file use something like:
>
> /<path>GetTime
> Create <path><Sys$TimeName> 0
If you follow that with
SetType <path><Sys$TimeName> &123
or similar, picking a hexadecimal filetype number that isn't in use within
the <path> concerned for any other file, then the newly created file will be
given that specific filetype, and will then be the only file with that
filetype inside that folder.
This makes it easy to get rid of the file created on a previous run before
creating a new one. You do it by:
Repeat Delete <path> -Type &123
- that is, by asking RO to perform the 'Delete' command against every file
it finds in <path> which has the filetype &123.
An alternative method could be something like the following, which creates a
file called LastUsed within the app's directory. The file is created as an
Obey file (so can later be clicked to run it if you think that's worthwhile)
and contains a command that will then tell you the relevant date and time.
Add the following lines to the app (FTPc)'s !Run file:
Remove <Obey$Dir>.LastUsed
Create <Obey$Dir>.LastUsed
SetType <Obey$Dir>.LastUsed Obey
Echo ERROR This app was last used at <Sys$Time> on <Sys$Date><Sys$Year> { >
<Obey$Dir>.LastUsed }
(The last line has probably wrapped, but is one line. Note that the spaces
around the opening & closing curly bracket are required.)
What these commands do is:
a) remove any previously-created LastUsed file from the directory
b) Create a new empty LastUsed file
c) Change that file's filetype to Obey
The next line is more complicated. Normally
Echo this that other
writes the text 'this that other' to the screen (or task window). Changing
it to
Echo this that other { > somefile }
redirects the output so instead of it going to the screen it ends up in the
specified file. So the command above writes:
ERROR This app was last used at <Sys$Time> on <Sys$Date><Sys$Year>
into the LastUsed Obey file. The values at that instant of <Sys$Time> etc
are used so the actual line in the Obey file will say something like
ERROR This app was last used at 01:23:45 on ...
When the Obey file is run that line is treated as a command, and what it
does is display a RO error box with that message in it.
--
Jeremy C B Nicoll - my opinions are my own.
Email sent to my from-address will be deleted. Instead, please reply
to newsreplyaaa@wingsandbeaks.org.uk replacing "aaa" by "284".
[toc] | [prev] | [next] | [standalone]
| From | Martin Bazley <martin.bazley@blueyonder.co.uk> |
|---|---|
| Date | 2011-08-12 15:02 +0100 |
| Message-ID | <6920a10152.martin@blueyonder.co.uk> |
| In reply to | #590 |
The following bytes were arranged on 12 Aug 2011 by Roger Darlington : > > I want a simple one-liner to insert in the run-file of FTPc that will > save a file (any file, one of zero length) that has the date and time > as the filename of that file. This is theoretically possible, using a combination of *Eval and *Create, but I suspect it can't be done in one line and without using system variables. Anyway... > This is just a simple way of showing me when I last ran FTPc. > I can look inside the FTPc app and look at the filename and see when I > last ran it. ...has it occurred to you that saving the time as the *filename* is completely useless for the task you want to do? All you'd end up with is a mess of files inside FTPc, one for each time you had ever run it, without previous times being deleted or overwritten. Finding out which was most recent would be far more trouble than simply using *Create to save a blank file of a fixed filename, and examining its datestamp from the Filer menu. If the filename doesn't change, then only one time - the most recent - can exist at once. -- __<^>__ / _ _ \ I don't have a problem with God; it's his fan club I can't stand. ( ( |_| ) ) \_> <_/ ======================= Martin Bazley ==========================
[toc] | [prev] | [next] | [standalone]
| From | Rick Murray <heyrickmail-usenet@yahoo.co.uk> |
|---|---|
| Date | 2011-08-13 01:03 +0200 |
| Message-ID | <4e45b130$0$30785$ba4acef3@reader.news.orange.fr> |
| In reply to | #596 |
On 12/08/2011 16:02, Martin Bazley wrote: > Finding out which was most recent would be far more trouble than simply > using *Create to save a blank file of a fixed filename, and examining > its datestamp from the Filer menu. If the filename doesn't change, then > only one time - the most recent - can exist at once. Plus it should be fairly simple to knock up a couple of lines of code that can be placed in Library, so you can check the date from the command line as easily as: *FTPDate or whatever. Could be quicker than wandering around to find the file to look at. A little bit more effort, it could even 'remember' so could report if the file date is different compared to the last time you used it. Best wishes, Rick.
[toc] | [prev] | [next] | [standalone]
| From | druck <news@druck.org.uk> |
|---|---|
| Date | 2011-08-13 15:06 +0100 |
| Message-ID | <j260ce$no$3@dont-email.me> |
| In reply to | #590 |
On 12/08/2011 08:46, Roger Darlington wrote:
> Is there a simple way of saving the
> date/time as a filename as a one-liner in a Run file?
Echo "" { > <Obey$Dir>.<Sys$Date> }
Or something similar to that which works.
---druck
[toc] | [prev] | [next] | [standalone]
| From | Roger Darlington <rogerarm@freeuk.com> |
|---|---|
| Date | 2011-08-16 08:23 +0100 |
| Message-ID | <32f28b0352.rogerarm@rogerarm.freeuk.com> |
| In reply to | #590 |
On 12 Aug 2011, Roger Darlington wrote: > I want a simple one-liner to insert in the run-file of FTPc that will > save a file (any file, one of zero length) that has the date and time > as the filename of that file. > This is just a simple way of showing me when I last ran FTPc. > I can look inside the FTPc app and look at the filename and see when I > last ran it. > Any ideas? Many thanks to all respondents. After taking on board a lot of what was said, I finally settled on; Create <FTPc$Dir>.TimeLastRun 0 SetType <FTPc$Dir>.TimeLastRun &123 Which puts the file at the top of the directory listing, so's I can easily find it :-) And it gets over-written each time. -- Cheers Roger Live each tomorrow as if there were no today
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.acorn.programmer
csiph-web