Run Script

Hi, Just using Theo script for random_playlist.

I have the script running perfectly (you’ll be pleased to hear!)

If i run the script via the actions menu it works perfectly - meaning that every time i run it i get a different playlist of random songs.

HOWEVER…

If i go into the config and on the ACTION AT STARTUP menu do the following:

Enable Automation
Run Script - relevant details
Start Automation Playback

i just keep getting the same playlist over and over.

If i then go to the action menu and run a script, i get a new playlist, then on the next startup onwards, i get that new playlist.

Im not sure why this is or whether it is definetly a bug?

Very odd!

Thanks

Hmmm… Does your script use the Random() function? Perhaps the random number generator hasn’t been initialized (with the Randomize() procedure) by the time the startup actions are executed, which means that it returns the same sequence of numbers everytime you start mAirList. When you run your script later through the action menu, some other component of mAirList might have initialized the generator in the mean time.

You could try to call Randomize at the top of your script, although I’m not sure whether it is available in the script engine, but I think it is. (If it’s not, I can easily put that call into the mAirList code.)

http://www.delphibasics.co.uk/RTL.asp?Name=Randomize

Sorry, that went straight over my head!

Basically, when mairlist is made to run the script at startup, it doesnt operate the whole random select part of the script, instead just loads the last playlist it made.

If you use the actions menu it does work as it should.

Im wondering in that case whether there is someway of getting the script to have a pause of say 10seconds to allow mairlist to load fully before it runs the script??

Would that work?

Running the startup actions is the second last thing mAirList done before it is fully initialized - the very last thing is calling OnStartup for all notification scripts. I don’t believe it makes sense to add a wait/sleep command. It would rather block mAirList from doing anything else (scripts don’t run a separate thread yet).

The script you’re using is this one here, isn’t it?
http://forum.mairlist.com/index.php/topic,3630.msg25304.html#msg25304

So if you’re saying that it “loads the last playlist it made”, then obviously the call to random_playlist.exe fails, or is not fast enough.

I propose that, for further testing, you change the ShellExcudeHidden command to ShellExecute, so you see if the program is really called. You should see the console window appear and disappear.

I agree with Torben. You first need to know whether or not the external program is working or not, Changing ShellExecuteHidden to ShellExecute means, as Torben says, that you will see the program start and stop if it is actually being run at startup time. If you don’t see that happening, let us know and we’ll try to help.

If you do see that ‘random_playlist’ window ‘come and go,’ but you’re still getting the same playlist every time, then we have a different problem. But like Torben, I suspect that the program is NOT running for some reason.

(Torben: there is no Random function in the script, the randomisation is all happening in the external EXE.)

BFN
CAD

Correct. I hadn’t realized that it’s that script with the external program he is using.

Ok, i have just changed the script to shellexecute and you are correct with your guess, nothing appears and disappears, so it would seem that it isn’t running that part of the script. Hope that helps.

Hi guys,

Just wondered if anybody is any further with this problem?

Many Thanks

Just as an extra note also…

i have tried taking the action menu away at launch up and instead am using a hotkey as a way of running the script. This works, but is still not randomizing the tracks it is choosing.

I know that the script is working fine because on the same machine i have the playout layout, where i run the same script from the toolbar and it works as it should. therefore, for some reason, it is with this version of mairlist (both running off the very latest snapshot.!)

Very odd i think you’ll agree!