English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 27 January 2020, 22:45   #1
Glen M
Registered User

 
Join Date: May 2017
Location: Belfast
Posts: 655
More script help please

Would it be possible to write a script to read all .cdxl files from a directory and store the names of said files in variables?

For example directory has 3 files named a, b, c.cdxl
Script would read files names and store in variables $video1, 2, 3.

That would allow me to echo the contents, prompt for selection then run the video with whatever arguments I need.

I was trying to use foreach but I get a command not recognised error? (or words to that effect)

Maybe I'm getting beyond what is possible with simple dos scripting.
Glen M is offline  
Old 27 January 2020, 23:54   #2
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,495
This should do the trick:
Code:
/* Usage: Script.rexx <path> */

PARSE ARG path

IF ~SHOW('L', 'rexxsupport.library') THEN
    IF ~ADDLIB('rexxsupport.library', 0, -30, 0) THEN
        EXIT 10

list = SHOWDIR(path, 'F', '0A'x)
DO i = 1 WHILE (list ~= '')
    PARSE VAR list file '0A'x list
    ADDRESS COMMAND 'setenv' 'video' || i '"' || file || '"'
END
daxb is offline  
Old 28 January 2020, 11:18   #3
Glen M
Registered User

 
Join Date: May 2017
Location: Belfast
Posts: 655
Quote:
Originally Posted by daxb View Post
This should do the trick:
Code:
/* Usage: Script.rexx <path> */

PARSE ARG path

IF ~SHOW('L', 'rexxsupport.library') THEN
    IF ~ADDLIB('rexxsupport.library', 0, -30, 0) THEN
        EXIT 10

list = SHOWDIR(path, 'F', '0A'x)
DO i = 1 WHILE (list ~= ' ')
    PARSE VAR list file '0A'x list
    ADDRESS COMMAND 'setenv' 'video' || i '"' || file || '"'
END
Thanks for this but can I ask for some more help.

I'm not that familiar with AREXX. What I think I am reading the loop puts the file names into a variable called video i with i increasing by 1 for each loop until there are no more files. Is that correct?

How do I refer to the video variable going forward? Could you maybe give me a small script to print out all video variables, that would let me see how to deal with it.
Glen M is offline  
Old 28 January 2020, 14:14   #4
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,495
Yes, your are correct. The first filename will be but in the ENV variable video1, second to video2, aso.. Access to ENV variables is the same you may know already (its simple DOS). E.g.:
Code:
echo $video2
or
Code:
getenv video3
If you want to output the video variables you can add this under the ADDRESS COMMAND line:
Code:
ADDRESS COMMAND 'getenv' 'video' || i
or
Code:
SAY 'video' || i
The DOS echo command should also work here. Try it.

I'm not sure what you want to do. So you may need to change the script to your needs. Feel free to ask again if something is not clear.
daxb is offline  
Old 28 January 2020, 14:38   #5
Glen M
Registered User

 
Join Date: May 2017
Location: Belfast
Posts: 655
Quote:
Originally Posted by daxb View Post
Yes, your are correct. The first filename will be but in the ENV variable video1, second to video2, aso.. Access to ENV variables is the same you may know already (its simple DOS). E.g.:
Code:
echo $video2
or
Code:
getenv video3
If you want to output the video variables you can add this under the ADDRESS COMMAND line:
Code:
ADDRESS COMMAND 'getenv' 'video' || i
or
Code:
SAY 'video' || i
The DOS echo command should also work here. Try it.

I'm not sure what you want to do. So you may need to change the script to your needs. Feel free to ask again if something is not clear.
Many thanks for the detailed reply. Makes sense reading it, just to put it into practice now.

I'm trying to build a script for using the AGA Blaster player. Currently its all command line arguments to load and play a video.

I have written a DOS script with all the info of my current video files in it which is fine until I change a file which got me thinking that if I could automate reading the file names then I could build a script anyone could use to easily and quickly play videos. I'm trying to get into a bit of coding again so thought this would be a simple project to start with.

Basic principal is to read directory and list out the cdxl videos against options 1 to whatever number of videos you have in there. User can pick video by typing relevant number and select if they want stats to be displayed after playback.

If I can get it working as I want I suppose down the line I can add more of an interface to it, little steps though. I understand the methods of writing simple code like this, its just getting used to the syntax can trip me up.
Glen M is offline  
Old 28 January 2020, 15:10   #6
Ami
Registered User

 
Join Date: Sep 2014
Location: Poland
Posts: 107
I'm not convinced about storing hundreds of file names in separate variables. Other alternatives are: simple text file or compound variable.

@Glen M
So you want shell-only interface, without loaded Workbench? If not, all you need is RequestFile with "#?.cdxl" in Pattern field.

Last edited by Ami; 28 January 2020 at 15:20.
Ami is offline  
Old 28 January 2020, 17:47   #7
Glen M
Registered User

 
Join Date: May 2017
Location: Belfast
Posts: 655
Quote:
Originally Posted by Ami View Post
I'm not convinced about storing hundreds of file names in separate variables. Other alternatives are: simple text file or compound variable.

@Glen M
So you want shell-only interface, without loaded Workbench? If not, all you need is RequestFile with "#?.cdxl" in Pattern field.
There won't be hundreds of variables. I can't see there ever being more than 20 to be honest and even that is a lot because of file size of the cdxl videos. A 3.5 minute file at 320x256 (low res), 256 colour, 25fps is about 500mb. Even lower colour and frame rate is still big files.

I'll take a look at requestfile but I don't see how I can use that information further within a script. I need the file name against a variable within the script so that I can refer to it later to load the video with whatever arguments I choose from my list.

In all this is only really for me and its to save me having to muck about creating single line scripts and icons to load each video. Plus it gives me something to poke around with an learn some more functions of my Amiga.
Glen M is offline  
Old 28 January 2020, 19:26   #8
Ami
Registered User

 
Join Date: Sep 2014
Location: Poland
Posts: 107
Quote:
Originally Posted by Glen M View Post

In all this is only really for me and its to save me having to muck about creating single line scripts and icons to load each video.
Have you tried Deficons?
I think I did something similiar, I wrote script for LHA and assigned it to deficon. Now, when double clicked lha file, requester pops up with options: "unpack here | unpack to ram: | list file | test file | cancel".
Ami is offline  
Old 01 February 2020, 19:13   #9
thairacerjp
Registered User

thairacerjp's Avatar
 
Join Date: Aug 2016
Location: FRANCE
Posts: 284




Hi CRG aka Glen M, I have just made a try for multiple CDXL and it's working good ! (low 320 and HIGH 640) thanks for your tips on your youtube video

[ Show youtube player ]

edit : oh, i've just notice that when the first movie is playing, normaly you presse LMB for stop but since there is multiple cdxl files, each time you click, you can go to the next "chapter" , nice feature

Last edited by thairacerjp; 01 February 2020 at 21:07.
thairacerjp is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script help -Acid- support.Other 6 09 July 2018 20:34
AmigaDos script help liviux76 Coders. Scripting 8 09 November 2017 16:20
Running a script under KS 1.3 DamienD support.Other 11 19 June 2016 15:29
Best script launcher jotd support.Games 7 29 December 2015 18:37
RebootStart script help! Overkill support.Other 43 23 April 2013 17:52

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.08137 seconds with 15 queries