Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 6:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: LauchFile pre-checks
PostPosted: August 5th, 2006, 12:59 pm 
Offline

Joined: July 13th, 2006, 1:14 pm
Posts: 3
Hey everyone,

Just reached that critical point in any project where the information a user enters needs to be critical for a project to work.

What im currently trying to do is get the user to enter information of where an .exe file is. This is then used in another program, to allow that exe to be launched. My problem is that i want to scrutinise data that is entered in by the user, and i want to pre-check a file exists, so it eliminates the need to have "sorry that file couldent be found"

currently i have a test rig thats the same as the help file example under LauchFile().

var Fname = SYSTEM_WIN_DIR + "\\notepad.exe"
var Params = SYSTEM_PUBLICATION_DIR + "\\readme.txt"
LaunchFile(Fname, Params)

This works, but if anyone knows how i could check that notepad.exe, and readme.txt exits before running the LaunchFile() command that would be great.


Top
 Profile  
 
 Post subject:
PostPosted: August 7th, 2006, 2:12 pm 
Offline

Joined: January 10th, 2005, 11:08 am
Posts: 63
Location: Birmingham, United Kingdom
Opus: All between ver Pro XE 4.5 and Ver 9.62
OS: Windows XP Pro SP3
System: Intel Core2 Duo 2.67Ghz, Matrox Millennium G550 dual head graphics card
Have you tried 'reading' the file into a variable, and then testing if that variable is empty or not. I have used this method in the past and found that it works for most files. I have only set it up in the action window with 'Read from disk file to <variable>' and then using an If statement to test the variable. I would think in script it would be something like:
var CHECK=OpenFile(SYSTEM_WIN_DIR\\notepad.exe)
CHECK.Read(false)
if(CHECK=" ")
{ does not exist statement }
else
{ does exist statement}

Hope this helps

_________________
Andy Thompson
Opus Pro XE 4.5, Pro 5.5, Ver 6, Ver 7, Ver 8.6, Ver 9.62
Windows XP Pro on an Intel Core2 Duo 2.67Ghz with a Matrox Millennium G550 LP PCIe dual-head card.


Top
 Profile Visit website  
 
 Post subject:
PostPosted: August 7th, 2006, 3:06 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
Just use the FileExists() script function. From the help:

Syntax:
FileExists( Filename )

Return:
A number indicating the state of the file:
Code:
Value  Meaning
0      the file does not exist
1      the file exists
2      the file exists but is read-only

Parameters:
Filename – the full pathname of the file to test for. This parameter is required.

Remarks:
This function will test if a specified fileexists at the given location.
This function will only work in the full player - not the screensaver, web plug-in or Flex.

_________________
ddww Opus Developer


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 72 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