Author Topic: Is there a file exists function or similar in squirrel? [SOLVED]  (Read 8542 times)

dbinott

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
I have looked around but can't really figure out if there is something like that.
« Last Edit: June 28, 2016, 06:28:52 PM by dbinott »

Daimon

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Is there a file exists function or similar in squirrel?
« Reply #1 on: June 24, 2016, 12:33:00 AM »
Try:

fe.load_module("file");
function file_exist(fullpathfilename)
   {
   try {file(fullpathfilename, "r" );return true;}catch(e){return false;}
   }
« Last Edit: June 26, 2016, 01:03:11 PM by Daimon »

dbinott

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Is there a file exists function or similar in squirrel?
« Reply #2 on: June 28, 2016, 06:26:23 PM »
sweet. thanks. worked great!

calle81

  • Sr. Member
  • ****
  • Posts: 184
    • View Profile
Re: Is there a file exists function or similar in squirrel? [SOLVED]
« Reply #3 on: May 01, 2017, 03:57:21 AM »
I need help with this file exist function. Trying to make a "default theme" when there is no video theme available. It will check for videotheme/"[Title].mp4". If that file does not exist load a background file and position and size the snap for that background.
I found this this snippet above but I'm not sure how to use it:

If anyone can shed some light on how to use this function it would be greatly appreciated.

calle81

  • Sr. Member
  • ****
  • Posts: 184
    • View Profile
Re: Is there a file exists function or similar in squirrel? [SOLVED]
« Reply #4 on: May 01, 2017, 10:43:41 AM »
To illustrate what I mean look at this video: https://www.youtube.com/watch?v=B9wIOi1hLeo&t=18s.

I want to improve this theme so that when there is no recorded hyperspin theme (these are just mp4 files) the snap is not played full screen. In the video you can see what currently happens at 1:15 when there is no video theme available. Thus I want to place the video themes in its own folder and have a check in the theme if the video theme file exists or not and adapt the theme to play the snap in a smaller window.

calle81

  • Sr. Member
  • ****
  • Posts: 184
    • View Profile
Re: Is there a file exists function or similar in squirrel? [SOLVED]
« Reply #5 on: May 06, 2017, 05:14:00 PM »
Soo

The file exist code breaks my theme. I load the the module and use this code:

If file_exist("videothemes/[DisplayName]/[Title].mp4"){
local snap = FadeArt( "snap", 0, 0, flw, flh );
snap.trigger = Transition.EndNavigation;
if ( my_config["Preserve_Aspect_Ratio"] == "Yes")
{
snap.preserve_aspect_ratio = true;
}
}

Anyone that can help me find the error?