Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 11th, 2025, 12:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Check if FileExists
PostPosted: November 14th, 2005, 5:56 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I've been unable to get the script action, FileExists, to work in a button. What I'm trying to do is (1) check if a file in a specific directory exists (using the correct pathname and syntax exactly as shown in the scripting help files, like \\ instead of \, plus quote marks in the correct places) and (2), if it does not exist, to trigger an action like show a text box, or copy a file to a folder.

I can't get it to work. I'm not sure how to script the if=0 (return value for a file that doesn't exist). I've tried setting up a variable called fileexists to hold the return from the FileExists action and an "if" statment to say
if fileexists=0, text.Show(), again using all the correct syntax.

Can't get it to work.

Any suggestions?

Kind Regards,
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: November 14th, 2005, 6:04 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
Code:
if ( FileExists( SYSTEM_PUBLICATION_DIR + "\\test.txt" ) )
{
  // File exists - do something
}
else
{
  // File does not exist - do something else
}

_________________
ddww Opus Developer


Last edited by Duncan Lilly on November 14th, 2005, 6:40 pm, edited 1 time in total.

Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 14th, 2005, 6:31 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

Thanks. I ran the following example script based on your suggestion:

if ( FileExists( "c:\\xyz\\abc.txt" )
{
// File exists - do something
GotoPage("Page_2")
}
else
{
// File does not exist - do something else
Text5188.Show()
}

Unfortunately, it failed to work, as before. :(

I've attached a sample imp file.

Any help would be appreciated. :)

Kind Regards,
Stephen


Last edited by Stephen on November 14th, 2005, 6:50 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: November 14th, 2005, 6:39 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
You've missed the closing bracket on the "If (FileExists..." line and the path does not contain a colon after the drive letter "C:\\...".

_________________
ddww Opus Developer


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 14th, 2005, 6:49 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Duncan

All fixed and working now.

Stephen :oops:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group