Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 10th, 2025, 11:51 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Closing open files
PostPosted: December 14th, 2005, 3:49 am 
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

Is there any way in a project to close all .txt files using a wildcard? In order to get the delete file action to work without script editor error messages, it appears these files, viewer-created in the Opus pub and opened in runtime to store data to disk files, need to be closed first. So far, my work-a-round has been to exit and re-start the pub after the delete action to "clear" it and prevent error messages, object not found type, which then lead to script failure.

Any ideas would be appreciated.

Kind Regards,
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: December 14th, 2005, 4:25 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'm continuing to experiment with trying to script a close file action. I'm unsure if you set up the script to close the actual file or set it up to close the textobject created by the openfile action.

So for the file myText.txt, which is opened as
var textObj = OpenFile("c:\\myText.txt")

do I use the file pathname to somehow script ?:

("c:\\myText.txt").Close()
(I'm unsure how to correctly specify the file's pathname, here. I also suspect this won't work.)

or can I effectively close the file by scripting?:

textObj.Close()

I'm confused as to how to close a file opened by a script

var textObj = OpenFile("c:\\myText.txt").

Part of my confusion is that if I were to use the standard Opus closefile action, it would specify the actual file-to-close's pathname and not a variable like textObj.

Any help would be appreciated.

Kind Regards,
Stephen


Top
 Profile  
 
 Post subject:
PostPosted: December 14th, 2005, 6:16 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
Stephen wrote:
textObj.Close()

This one - you need to close the file object. The location and name of the file has no bearing on it.

_________________
ddww Opus Developer


Top
 Profile Visit website  
 
 Post subject:
PostPosted: December 14th, 2005, 6:45 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.

I had actually experimented with this, as part of trying everything conceiveable. The open file scripts are individualized for each object so the first object textobj variable is simply textobj, the second is named textobja, third, textobjb and so forth. There are 50 or so objects each with their own variation a-w and aa-ww.

The experiment involved textobj.Close() and a second script textobja.Close(). Then the 2 actual .txt files, which are opened as the textobj and textobja variables, found in SYSTEM_DOCUMENTS_DIR foldername\pos.txt and foldername\posa.txt, were each deleted using a standard Opus delete file action. (I couldn't figure out how to delete these files using script-the standard action had to suffice.)

Irregardless, this should have closed and cleared out the storage files. Returning to the page to recreate new data and storage, etc. (starting fresh), the script editor now showed error messages upon save and reset: object(s) not found.

I'm not knowledgeable about why, but it almost seems that absent exiting the entire pub and re-booting it, something is held in a cache-like place, causing error messages (and eventually script failure).

Is there any effective way to close, clear, delete these .txt files and not have them cause error messages and eventual script failure?

Thank you for your help.

Kind Regards,
Stephen


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 27 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