![]() |
![]() |
#1 |
Registered User
Join Date: May 2017
Location: Belfast
Posts: 750
|
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. |
![]() |
![]() |
#2 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,307
|
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 |
![]() |
![]() |
#3 | |
Registered User
Join Date: May 2017
Location: Belfast
Posts: 750
|
Quote:
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. |
|
![]() |
![]() |
#4 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,307
|
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 Code:
getenv video3 Code:
ADDRESS COMMAND 'getenv' 'video' || i Code:
SAY 'video' || i ![]() 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. |
![]() |
![]() |
#5 | |
Registered User
Join Date: May 2017
Location: Belfast
Posts: 750
|
Quote:
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. |
|
![]() |
![]() |
#6 |
Registered User
Join Date: Sep 2014
Location: Poland
Posts: 175
|
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. |
![]() |
![]() |
#7 | |
Registered User
Join Date: May 2017
Location: Belfast
Posts: 750
|
Quote:
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. |
|
![]() |
![]() |
#8 | |
Registered User
Join Date: Sep 2014
Location: Poland
Posts: 175
|
Quote:
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". |
|
![]() |
![]() |
#9 |
Registered User
Join Date: Aug 2016
Location: FRANCE
Posts: 375
|
![]() ![]() ![]() Hi CRG aka Glen M, I have just made a try for multiple CDXL and it's working good ! (low 320 and HIGH 640) ![]() ![]() [ 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. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
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 |
|
|