Close File question

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Close File question

charles61
I have the name and location of a file in a variable, gOpenDataFile. For example:
/Users/cszasz/Documents/School Personnel/Tom Jones.txt

Can I use the following: Put empty into gOpenDataFile to close a file? The reason I ask is that I have been unable to use the Close File command to close files.
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

xtalkprogrammer
Charles,

No, you must use the close file command.
What makes you think you're unable to do so?
You could also use get URL or put URL instead of open-read/write-close.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 17:29, charles61 wrote:

>
> I have the name and location of a file in a variable, gOpenDataFile. For
> example:
> /Users/cszasz/Documents/School Personnel/Tom Jones.txt
>
> Can I use the following: Put empty into gOpenDataFile to close a file? The
> reason I ask is that I have been unable to use the Close File command to
> close files.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

charles61
Hi Mark,

This is the script that I have tried using the close command for "Don't Save". I tried the following which did not work in the script below: 
Close file "file:" & gOpenDataFile


case "New Student Referral"
      go to card "referral"  

      

      if field "first" of card "referral" is not empty then ---> Name field is not empty.
         if gOpenDataFile is not empty then  ---> A saved file is open.
            set the itemDel to "/"
            put item -1 of gOpenDataFile into tFileName
            answer warning "Save changes to " & tFileName &"?" with "Don't Save" or "Cancel" or "Save" titled "Save File"

            

            --->answer warning "Save changes to: "with "Don't Save" or "Cancel" or "Save" titled "Save File?"
            --->Your changes will be lost if you do not save them.

            

            if it = "Don't Save" then close file "file:" & gOpenDataFile -->New 10-25-10: Close file 
            

Charles Szasz
[hidden email]




On Oct 26, 2010, at 11:33 AM, Mark Schonewille-3 [via Runtime Revolution] wrote:

Charles,

No, you must use the close file command.
What makes you think you're unable to do so?
You could also use get URL or put URL instead of open-read/write-close.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 17:29, charles61 wrote:

>
> I have the name and location of a file in a variable, gOpenDataFile. For
> example:
> /Users/cszasz/Documents/School Personnel/Tom Jones.txt
>
> Can I use the following: Put empty into gOpenDataFile to close a file? The
> reason I ask is that I have been unable to use the Close File command to
> close files.


_______________________________________________
use-revolution mailing list
<a href="x-msg://74/user/SendEmail.jtp?type=node&amp;node=3013938&amp;i=0" target="_top" rel="nofollow">[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





Reply | Threaded
Open this post in threaded view
|

Re: Close File question

mwieder
charles61-

Tuesday, October 26, 2010, 8:42:48 AM, you wrote:

> Close file "file:" & gOpenDataFile

1. close file gOpenDataFile
2. What's the difference between "Don't Save" and "Cancel"?

--
-Mark Wieder
 [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

charles61
In reply to this post by xtalkprogrammer
Mark,

I also tried the following which did not work. Any suggestions?

close file URL ("file:" & gOpenDataFile)

Charles Szasz
[hidden email]




On Oct 26, 2010, at 11:33 AM, Mark Schonewille-3 [via Runtime Revolution] wrote:

Charles,

No, you must use the close file command.
What makes you think you're unable to do so?
You could also use get URL or put URL instead of open-read/write-close.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 17:29, charles61 wrote:

>
> I have the name and location of a file in a variable, gOpenDataFile. For
> example:
> /Users/cszasz/Documents/School Personnel/Tom Jones.txt
>
> Can I use the following: Put empty into gOpenDataFile to close a file? The
> reason I ask is that I have been unable to use the Close File command to
> close files.


_______________________________________________
use-revolution mailing list
<a href="x-msg://76/user/SendEmail.jtp?type=node&amp;node=3013938&amp;i=0" target="_top" rel="nofollow">[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





Reply | Threaded
Open this post in threaded view
|

Re: Close File question

xtalkprogrammer
In reply to this post by charles61
Hi Charles,

The line

if it = "Don't Save" then close file "file:" & gOpenDataFile -->New 10-25-10: Close file

should be:

if it = "Don't Save" then close file gOpenDataFile -->New 10-25-10: Close file

I don't see an open file command in your script. Do you keep the file open all the time? You might get an error "file already open" if your application crashes and tries to open it again the next session. You won't be able to determine whether another programme is using that file or the file is incorrectly flagged as open. You may also have a problem when you try to delete the file. I would recommend to keep files closed while you're not reading or writing.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 17:42, charles61 wrote:

>
> Hi Mark,
>
> This is the script that I have tried using the close command for "Don't Save". I tried the following which did not work in the script below:
> Close file "file:" & gOpenDataFile
>
>
> case "New Student Referral"
>      go to card "referral"  
>
>      if field "first" of card "referral" is not empty then ---> Name field is not empty.
>         if gOpenDataFile is not empty then  ---> A saved file is open.
>            set the itemDel to "/"
>            put item -1 of gOpenDataFile into tFileName
>            answer warning "Save changes to " & tFileName &"?" with "Don't Save" or "Cancel" or "Save" titled "Save File"
>
>            --->answer warning "Save changes to: "with "Don't Save" or "Cancel" or "Save" titled "Save File?"
>            --->Your changes will be lost if you do not save them.
>
>            if it = "Don't Save" then close file "file:" & gOpenDataFile -->New 10-25-10: Close file
>
>
> Charles Szasz
> [hidden email]
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

xtalkprogrammer
In reply to this post by charles61
Hi Charles,

You use EITHER

open file gOpenDataFile
read from/write to file gOpenDataFile
close file gOpenDataFile

OR

put/get URL ("file:" & gOpenDataFile)

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 18:00, charles61 wrote:

>
> Mark,
>
> I also tried the following which did not work. Any suggestions?
>
> close file URL ("file:" & gOpenDataFile)
>
> Charles Szasz
> [hidden email]
>
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

charles61
Mark,

Thanks for your suggestions!

Charles Szasz
[hidden email]




On Oct 26, 2010, at 12:07 PM, Mark Schonewille-3 [via Runtime Revolution] wrote:

Hi Charles,

You use EITHER

open file gOpenDataFile
read from/write to file gOpenDataFile
close file gOpenDataFile

OR

put/get URL ("file:" & gOpenDataFile)

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce Create installers for Mac and Windows on *every* Rev-compatible platform. No additional software needed.

On 26 okt 2010, at 18:00, charles61 wrote:

>
> Mark,
>
> I also tried the following which did not work. Any suggestions?
>
> close file URL ("file:" & gOpenDataFile)
>
> Charles Szasz
> <a href="x-msg://82/user/SendEmail.jtp?type=node&amp;node=3014012&amp;i=0" target="_top" rel="nofollow">[hidden email]
>
>
_______________________________________________
use-revolution mailing list
<a href="x-msg://82/user/SendEmail.jtp?type=node&amp;node=3014012&amp;i=1" target="_top" rel="nofollow">[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





Reply | Threaded
Open this post in threaded view
|

Re: Close File question

slylabs13
In reply to this post by charles61
Charles, try using the full path to the file. I noticed you are using a relative path. Not sure if that makes a difference but give it a shot. Also try closing the file using a literal, that is using the value and not the variable.

Bob


On Oct 26, 2010, at 8:29 AM, charles61 wrote:

>
> I have the name and location of a file in a variable, gOpenDataFile. For
> example:
> /Users/cszasz/Documents/School Personnel/Tom Jones.txt
>
> Can I use the following: Put empty into gOpenDataFile to close a file? The
> reason I ask is that I have been unable to use the Close File command to
> close files.
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Close-File-question-tp3013929p3013929.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

charles61
Bob,

I thought that I was using the full filePath (/Users/cszasz/Documents/S504 School Personnel/Tom Jones.txt)! And how do you use a literal in closing a file?

Charles Szasz
[hidden email]




On Oct 26, 2010, at 12:15 PM, Bob Sneidar-2 [via Runtime Revolution] wrote:

Charles, try using the full path to the file. I noticed you are using a relative path. Not sure if that makes a difference but give it a shot. Also try closing the file using a literal, that is using the value and not the variable.

Bob


On Oct 26, 2010, at 8:29 AM, charles61 wrote:

>
> I have the name and location of a file in a variable, gOpenDataFile. For
> example:
> /Users/cszasz/Documents/School Personnel/Tom Jones.txt
>
> Can I use the following: Put empty into gOpenDataFile to close a file? The
> reason I ask is that I have been unable to use the Close File command to
> close files.
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Close-File-question-tp3013929p3013929.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> <a href="x-msg://92/user/SendEmail.jtp?type=node&amp;node=3014028&amp;i=0" target="_top" rel="nofollow">[hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
<a href="x-msg://92/user/SendEmail.jtp?type=node&amp;node=3014028&amp;i=1" target="_top" rel="nofollow">[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





Reply | Threaded
Open this post in threaded view
|

Re: Close File question

slylabs13
I was going to say, the full path might look like "Macintosh HD/Users/bobsneidar/Documents/Test File.txt", but this did not work. When I substituted the forward slashes with colon's, it DID create a file, but it was called "Macintosh HD/Users/bobsneidar/Documents/Test File.txt" (that is the real name of the file not the path) and it put it in the Applications folder! EEEK! It's not Holloween yet!

Bob


On Oct 26, 2010, at 9:20 AM, charles61 wrote:

> Bob,
>
> I thought that I was using the full filePath (/Users/cszasz/Documents/S504 School Personnel/Tom Jones.txt)! And how do you use a literal in closing a file?
>
> Charles Szasz
> [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Close File question

Francis Nugent Dixon
In reply to this post by charles61
Hi from Beautiful Brittany,

There seems to be some confusion about how to define
a full file name on your computer.

On the Mac, you don't specify the main disk drive,
it is implicit, so you start with the second level
(beginning with a "/")
On a PC you must start with the first level, i.e.
the disk drive (don't ask me why !).

so :

put "/RevFolder/PDF Files/" into LVFilePath
defines a file path.

put "File1.pdf" into LVFileName
defines a file name.

put LVFilePath & LVFileName into LVFullName
defines the full name ....... on a Mac,

and

put "C:" & LVFilePath & LVFileName into LVFullName
defines the full name ........  on a PC
(if, of course, your disk drive is "C:")

And, as specified by Mark, and others :

open file LVFullName
read file LVFullName into LVworkArea [until ...]
close file LVFullName

Best Regards

-Francis

"Nothing should ever be done for the first time !"


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution