'Immediate' Echo in Obey
Chris Mahoney (1684) 2165 posts |
I’ve made an Obey file that copies a bunch of files, and it takes a couple of minutes to run so I’ve tried to put some Echo commands in there to show progress. However, it doesn’t work how I expected. Instead of displaying each message as it gets to it, it just displays nothing until the script has run to completion, then it displays all the messages at once. Am I missing something simple here or is it more complicated that that? File is typed Obey and I’m running it in a task window. |
David J. Ruck (33) 1635 posts |
Copy commands can’t be interrupted by the task window, and it is likely that any VDU output generated by the echo commands in the task window wont be displayed by the task window handling application before the next copy command starts. If you want to do copies in a task window write a BASIC program which copies the files in reasonable sized chunks, which will allow the task window to interrupt the program, allowing other applications to run including the task window handling application. |
Raik (463) 2061 posts |
I do the same but use TaskObey instead of Obey with no problems for me. Not sure what the difference are. |
Chris Mahoney (1684) 2165 posts |
Thanks for the replies. It seems that it’s not something simple after all.
I’m just going to leave this in the too-hard basket at this point; the script is just for my own personal use so I’ll just put up with it.
TaskObey exhibits the same issue here. |
Chris Mahoney (1684) 2165 posts |
Well, I say that, but then I realised I can just take the existing Obey file, put a star in front of every line, change the echos to PRINTs and then save it as a BASIC file. Seems to work fine. Thanks for the tip :) |
David J. Ruck (33) 1635 posts |
Chris, try this. Save as FileCopy and use as
|
Ronald (387) 195 posts |
(Not in relation to Drucks reply) Been away over a year, I recall that you can get better results by running a file with your commands using the Taskwindow command. |
Jeff Doggett (257) 234 posts |
Unlike *copy, the BASIC proggy doesn’t seem to preserve the filetype & timestamp. |
Steve Drain (222) 1620 posts |
For a number of reasons, I am afraid I did not like druck’s BASIC, so I have just knocked up my own version: REM>FileCopy REM Copy file in blocks - with acknowledgments to druck REM *FileCopy input output [-stamp] [-block <size>] ON ERROR PROCerror *ReportClear SYS"OS_GetEnv" TO envr% SYS"OS_ReadArgs",",quit,in,out,stamp/s,block/e",envr%,&6000,&2000 SYS"XOS_GenerateError",!&6008 TO I$:REM file to copy from SYS"XOS_GenerateError",!&600C TO O$:REM name to copy to stamp%=!&6010:REM stamp file with current datetime block%=!&6014:IF block% THEN block%=block%!1 ELSE block%=1024*1024 DIM buff% block%-1 i%=INSTR(O$,"."):WHILE i%:REM while 'to' path has directories SYS"OS_File",8,LEFT$(O$,i%-1):REM create directory if required i%=INSTR(O$,".",i%+1) ENDWHILE I%=OPENIN I$:IF I% ELSE ERROR 1,"Cannot open "+I$ O%=OPENOUT O$:IF O% ELSE ERROR 1,"Cannot open "+O$ REPEAT SYS"OS_GBPB",4,I%,buff%,block% TO ,,,rest% SYS"OS_GBPB",2,O%,buff%,block%-rest% UNTIL EOF#I% CLOSE#I%:I%=0 CLOSE#O%:O%=0 SYS"OS_File",17,I$ TO ,,load%,exec%,,attr%:REM 'from' details SYS"OS_File",1 ,O$,load%,exec%,,attr%:REM apply to 'to' IF stamp% THEN SYS"OS_File",9 ,O$:REM stamp if chosen END DEFPROCerror ON ERROR OFF I%=I%:IF I% THEN CLOSE#I% O%=O%:IF O% THEN CLOSE#O% *ReportError T END This does preserve the original attributes, but allows a current time stamp if required. It also allows a choice of block size, with a default to 1M. This is only briefly tested, so please pull it apart. ;-) |
Rick Murray (539) 13840 posts |
Uh oh! Time for a duel. 1
I know that abuse of SYS is widely used (including by myself!), but ugh, it makes my toes curl… 1 Chanting mindlessly: two men enter, one man leaves, two men enter, one man leaves, two…. |
David J. Ruck (33) 1635 posts |
Don’t care, its been working for me for past 24 years. |
Chris Mahoney (1684) 2165 posts |
What have I done?! I go to sleep and then wake to find a BASIC duel! This is where I repeat my “Seems to work fine” from post #5. If you wish to continue duelling then that’s fine, but please don’t expend too much effort on my account :) |