?
Solved

I need to be able to have Director open up the windows Notepad so the user can take notes while studying from the CD-ROM.

Posted on 2004-11-22
8
Medium Priority
?
202 Views
Last Modified: 2013-12-24
I already have a button in director tiled "Notepad".  I need the script and any additional info so I can have the user click on the notepad button and have it open up notepad so they can take notes.  Once they are done taking notes in notepad and they have saved it to a location on their PC, I need for that same file to be opened back up if they click on the notepad button again.  I am re-creating an interactive CD-ROM and the way they have this set up is with one button.  When there is no saved notepad text file, the button opens up a blank notepad text file.  When the user saves the notepad text file, that very same button opens that text file again instead of a new notepad text file.
0
Comment
Question by:kishfy
  • 4
  • 3
8 Comments
 
LVL 20

Accepted Solution

by:
MediaMacros earned 80 total points
ID: 12647795
Buddy API will be easiest (www.mods.com.au or www.mediamacros.net/customer)

Just use baOpenFile with the name of the file to open wit the default editor...

baOpenFile("c:\file.txt", "normal")

If you want to make a new file use file IO...

myFile = xtra( "fileio")new()            
createFile( myfile, "c:\file.txt")
myFIle = void

THen open it...

baOpenFile("c:\file.txt", "normal")
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 12647800
Oh, you can also use baFileExists() to see if the file exists before creating a new one.  You can additionally use File Xtra 3 or 4 to do the same type of opperation.
0
 

Author Comment

by:kishfy
ID: 12651135
OK, this makes no sense to me, as I am a beginner.  I tried this script on the button under the "on mouseUp me" section and nothing works.  Here is the deal, I have a button with absolutely no script on it.  What exactly do I need to put as the script?  I need to have this button open up notepad, then I need this same button to be able to open up the file I created with notepad when pressed again.  

I dont understand what ( ) means or what is supposed to go inside these brackets in your example.  Is there a place where I can download an example .dir file to look at the code and how this is done?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 5

Expert Comment

by:LingoMaster
ID: 12651691
 Your objective is a bit on the advanced side, I suspect some compromise, either a great simplification, or some serious code sikill advancement would be needed.

 Director's built in Open commnd which can open a file with an application when given the exact path to both is only suitable for applications, like kiosks, where you have total control over the system configuration.
  For projects distributed on a Cd, where you don't  know the drive letter it's running off and can't guarantee what editors are installed, or where they are located, you have to be a bit more tricky.
  The buddyAPI Xtra is a 3rd party add-on, they have a tiered pricing scheme allowing a project using only 2 of it''s functions for free.
  The baOpenFile("c:\file.txt", "normal")
   example cited earlier had the smarts to loolkup the program registered to open a .text file, te same as double clicking it in the file manager does.  This default application setup by the user may well be something other than notepad.
  If you can deal with various end user editors being used, the code would just hae to be refined perhaps to open a file from the projector's volume
    The baOpenFile(the pathName & "someDoc.txt", "normal")  will open the someDoc.txt file located in the same folder as the director file.

  Unless the user is given strict instructions, the name and the location of the file they saved in notepad may be unknown, this is probably the most dificult part of whar you are attempting, I have not heard of one being able to read the 'recent documents' record that may be kept for notepad.

If the document is kept simple (probably so if notepad is involved)  you may well be able to simulate an editor inside of director, using the fileIO xtra to open and save the text files, having Director in charge of file saves may be the only way you can keep a record of the user's activity, specificly where and what name a file gets saved under.  Xtras, like fileIO have a language of their own and are not all that easy to program.

Here's a lnk to a introductory article on the FileIO xtra, with example code to save a field to a text file.

http://www.macromedia.com/support/director/ts/documents/tn3192.html



Here's an article (with source code) showing the code involved in simulating a spreadsheet application, this may give you the feel for the complexity of programming you would be facing.

http://director-online.com/buildArticle.php?id=883
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 12654351
The code I supplied was an example.  You will need to sub my path for hte actual path to your file.  If its relative to teh movie then you need to use the lingo...
the moviePath
to find the file.  For example, to load a file named "file.txt" in the same folder as the movie use...

baOpenFile(the moviePath & "file.txt", "normal")
0
 

Author Comment

by:kishfy
ID: 12655858
WOW, I thank you for this elaberate information.  This is a great site!  I am going to try to put this info to use!  I'll close this question and post my comments by weeks end!
0
 

Author Comment

by:kishfy
ID: 12657175
OK, I was able to make director create a file called Notes.txt at this location C:\Notes.txt  I was also able to make director open that very same file with the same button immediately after the lingo created the text file.  If the user types date into the text file and saves it, when I use this button again, it opens the text file and all of the user date is still there.  This is great and exactly what I want, but here is the glitch.  This only works when I am playing the movie in director.  I have no problems and the button does exactly what I need it to do.  The problem is after creating a projector and then run the project from the projector.  When I use the button from the projector, I get a prompt saying "Script Error"  Why is it that I can have my button create a new text file then open the text file with the default editor using File I/O and playing the project within Director but the same button does not function from the projector.  I have included the File I/O extra in the projector as well as the baOpen xtra.  Here is the script I used on the button to make it work within Director.

on mouseUp me
  myFile = new(xtra "fileio")            
  createFile(myfile, "c:\notes.txt")
  myFIle = void
  baOpenFile("c:\notes.txt", "normal")
end

Do I need to create this text file in a place other than C:\, is this my problem?  I will be running this project off of a CD-ROM so I cant have the text file in the director project directory because the user will not be able to write to the CD.

Kevin

0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 12657475
Buddy API can also find user folders...

iFOlder = baSysFolder("desktop")
or
iFolder = baSysFolder("documents")
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question