dbTalk Databases Forums  

Deleting a file

comp.databases.filemaker comp.databases.filemaker


Discuss Deleting a file in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ursus
 
Posts: n/a

Default Deleting a file - 01-19-2007 , 09:16 AM






Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried without
result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working from
MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ; ["/";
"\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ; "" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the final
variable $DeleteFile does contain the correct path and filename. (Both with
\ or / tried)

What next?

Ursus



Reply With Quote
  #2  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Deleting a file - 01-19-2007 , 11:24 AM






I just tried your first script and it worked with no problem.
Nonetheless, I'm not sure why you are bothering with the
$CurrentFileName and the substitution, since that really has nothing to
do with anything.

Try running the Send Event step with "cmd /k del " & $DeleteFile. By
using the /k flag, you will be able to see the DOS dialog and any error
messages that get generated. My guess is that your target file is
already open in FMP and can therefore not be deleted.


Ursus wrote:
Quote:
Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried without
result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working from
MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ; ["/";
"\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ; "" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the final
variable $DeleteFile does contain the correct path and filename. (Both with
\ or / tried)

What next?

Ursus


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #3  
Old   
Ursus
 
Posts: n/a

Default Re: Deleting a file - 01-19-2007 , 03:49 PM



Well Howard here we are stuck with the same problem as with my previous link
about error capture.

I have tried the /k option and it says that the file is already in use by an
other process. It is NOT in the list under Window, but somehow filemaker has
activated the file.

Ursus


"Howard Schlossberg" <howard (AT) antispahm (DOT) fmprosolutions.com> schreef in
bericht news:12r1vlpte0jlhe7 (AT) corp (DOT) supernews.com...
Quote:
I just tried your first script and it worked with no problem. Nonetheless,
I'm not sure why you are bothering with the $CurrentFileName and the
substitution, since that really has nothing to do with anything.

Try running the Send Event step with "cmd /k del " & $DeleteFile. By
using the /k flag, you will be able to see the DOS dialog and any error
messages that get generated. My guess is that your target file is already
open in FMP and can therefore not be deleted.


Ursus wrote:
Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried
without result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working from
MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ;
["/"; "\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ; "" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the
final variable $DeleteFile does contain the correct path and filename.
(Both with \ or / tried)

What next?

Ursus

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance



Reply With Quote
  #4  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: Deleting a file - 01-20-2007 , 12:44 AM



I read what Howard and you said on this subject : I didn't understand it
all, though.
All I wish to add is that - as it has been for long not obvious to me - that
as soon as a file is 'open' in FileMaker (maybe through an old relationship
somewhere) it is considered as 'activated' even if you do not use it at the
moment.
Perhaps, it's the reason why you can't delete it. If so, you may 'close' it,
just in case (?).
By the way, the Troi File plugin - and others - can delete a file and even
folders from within a script.
Remi-Noel

"Ursus" <ursus.kirk (AT) wanadoo (DOT) nl> a écrit dans le message de news:
45b13cde$0$43971$dbd45001 (AT) news (DOT) wanadoo.nl...
Quote:
Well Howard here we are stuck with the same problem as with my previous
link about error capture.

I have tried the /k option and it says that the file is already in use by
an other process. It is NOT in the list under Window, but somehow
filemaker has activated the file.

Ursus


"Howard Schlossberg" <howard (AT) antispahm (DOT) fmprosolutions.com> schreef in
bericht news:12r1vlpte0jlhe7 (AT) corp (DOT) supernews.com...
I just tried your first script and it worked with no problem. Nonetheless,
I'm not sure why you are bothering with the $CurrentFileName and the
substitution, since that really has nothing to do with anything.

Try running the Send Event step with "cmd /k del " & $DeleteFile. By
using the /k flag, you will be able to see the DOS dialog and any error
messages that get generated. My guess is that your target file is
already open in FMP and can therefore not be deleted.


Ursus wrote:
Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried
without result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working
from MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ;
["/"; "\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ; "" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the
final variable $DeleteFile does contain the correct path and filename.
(Both with \ or / tried)

What next?

Ursus

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance





Reply With Quote
  #5  
Old   
Ursus
 
Posts: n/a

Default Re: Deleting a file - 01-20-2007 , 03:14 AM



Remi-Noel,

I know that a file, once referenced, is regarded as active. (Which is not
quite the same as open). An open file can be seen in the menu>windows>bottom
part. An active file, although referenced by filemaker does not appear
anywhere. My guess now is that allthough the script-step to perform the
external script has not been triggered yet, FileMaker somehow has veryfied
the link to the script. This link is to the old file which need replaced.
But by checking filemaker has made the file active (not yet open).

I have drawn this conclusion after trying several command-line options, and
getting an error back that the file already is referenced. I do know about
troy, but these are pretty expensive and would not solve the already-active
problem. I am currently looking into vbs and for osx creating an
applescript. I rather do it automaticaly, I fear that when I instruct my
users to have to empty the table they will forget or not understand and just
not do it.

ursus

"Remi-Noel Menegaux" <rnmenegaux_AT_free.fr> schreef in bericht
news:45b1ba53$0$31042$426a34cc (AT) news (DOT) free.fr...
Quote:
I read what Howard and you said on this subject : I didn't understand it
all, though.
All I wish to add is that - as it has been for long not obvious to me -
that as soon as a file is 'open' in FileMaker (maybe through an old
relationship somewhere) it is considered as 'activated' even if you do not
use it at the moment.
Perhaps, it's the reason why you can't delete it. If so, you may 'close'
it, just in case (?).
By the way, the Troi File plugin - and others - can delete a file and even
folders from within a script.
Remi-Noel

"Ursus" <ursus.kirk (AT) wanadoo (DOT) nl> a écrit dans le message de news:
45b13cde$0$43971$dbd45001 (AT) news (DOT) wanadoo.nl...
Well Howard here we are stuck with the same problem as with my previous
link about error capture.

I have tried the /k option and it says that the file is already in use by
an other process. It is NOT in the list under Window, but somehow
filemaker has activated the file.

Ursus


"Howard Schlossberg" <howard (AT) antispahm (DOT) fmprosolutions.com> schreef in
bericht news:12r1vlpte0jlhe7 (AT) corp (DOT) supernews.com...
I just tried your first script and it worked with no problem.
Nonetheless, I'm not sure why you are bothering with the $CurrentFileName
and the substitution, since that really has nothing to do with anything.

Try running the Send Event step with "cmd /k del " & $DeleteFile. By
using the /k flag, you will be able to see the DOS dialog and any error
messages that get generated. My guess is that your target file is
already open in FMP and can therefore not be deleted.


Ursus wrote:
Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried
without result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working
from MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ;
["/"; "\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ; "" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the
final variable $DeleteFile does contain the correct path and filename.
(Both with \ or / tried)

What next?

Ursus

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance







Reply With Quote
  #6  
Old   
eyebrown@mindspring.com
 
Posts: n/a

Default Re: Deleting a file - 01-20-2007 , 07:28 AM



Have you tried forcing the file truly open in your script, then closing it
from the script? Maybe that will sufficiently "deactivate" it. Lingering
relationships won't let this happen, of course, but in the absence of
relationships, this might work.

I'm a big fan of the Troi file plugin as well. I'm surprised that after
all these years that FM has *still* not implemented into itself the basic
functions this plugin does. Or bought the plugin frpm Troi and simply
absorbed it.

Steve Brown

In article <45b1dd72$0$92122$dbd4b001 (AT) news (DOT) wanadoo.nl>, "Ursus"
<ursus.kirk (AT) wanadoo (DOT) nl> wrote:

Quote:
Remi-Noel,

I know that a file, once referenced, is regarded as active. (Which is not
quite the same as open). An open file can be seen in the menu>windows>bottom
part. An active file, although referenced by filemaker does not appear
anywhere. My guess now is that allthough the script-step to perform the
external script has not been triggered yet, FileMaker somehow has veryfied
the link to the script. This link is to the old file which need replaced.
But by checking filemaker has made the file active (not yet open).

I have drawn this conclusion after trying several command-line options, and
getting an error back that the file already is referenced. I do know about
troy, but these are pretty expensive and would not solve the already-active
problem. I am currently looking into vbs and for osx creating an
applescript. I rather do it automaticaly, I fear that when I instruct my
users to have to empty the table they will forget or not understand and just
not do it.

ursus

"Remi-Noel Menegaux" <rnmenegaux_AT_free.fr> schreef in bericht
news:45b1ba53$0$31042$426a34cc (AT) news (DOT) free.fr...
I read what Howard and you said on this subject : I didn't understand it
all, though.
All I wish to add is that - as it has been for long not obvious to me -
that as soon as a file is 'open' in FileMaker (maybe through an old
relationship somewhere) it is considered as 'activated' even if you do not
use it at the moment.
Perhaps, it's the reason why you can't delete it. If so, you may 'close'
it, just in case (?).
By the way, the Troi File plugin - and others - can delete a file and even
folders from within a script.
Remi-Noel

"Ursus" <ursus.kirk (AT) wanadoo (DOT) nl> a écrit dans le message de news:
45b13cde$0$43971$dbd45001 (AT) news (DOT) wanadoo.nl...
Well Howard here we are stuck with the same problem as with my previous
link about error capture.

I have tried the /k option and it says that the file is already in use by
an other process. It is NOT in the list under Window, but somehow
filemaker has activated the file.

Ursus


"Howard Schlossberg" <howard (AT) antispahm (DOT) fmprosolutions.com> schreef in
bericht news:12r1vlpte0jlhe7 (AT) corp (DOT) supernews.com...
I just tried your first script and it worked with no problem.
Nonetheless, I'm not sure why you are bothering with the $CurrentFileName
and the substitution, since that really has nothing to do with anything.

Try running the Send Event step with "cmd /k del " & $DeleteFile. By
using the /k flag, you will be able to see the DOS dialog and any error
messages that get generated. My guess is that your target file is
already open in FMP and can therefore not be deleted.


Ursus wrote:
Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried
without result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working
from MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ;
["/"; "\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ; "" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the
final variable $DeleteFile does contain the correct path and filename.
(Both with \ or / tried)

What next?

Ursus

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance





Reply With Quote
  #7  
Old   
Ursus
 
Posts: n/a

Default Re: Deleting a file - 01-21-2007 , 07:24 AM



Thanks Steve,

I did not have the chance to test this yet, but I will try it and see what
happens.

Ursus
<eyebrown (AT) mindspring (DOT) com> schreef in bericht
news:eyebrown-2001070832570001 (AT) 209-42-139-182 (DOT) earthlink.wispnet.net...
Quote:
Have you tried forcing the file truly open in your script, then closing it
from the script? Maybe that will sufficiently "deactivate" it. Lingering
relationships won't let this happen, of course, but in the absence of
relationships, this might work.

I'm a big fan of the Troi file plugin as well. I'm surprised that after
all these years that FM has *still* not implemented into itself the basic
functions this plugin does. Or bought the plugin frpm Troi and simply
absorbed it.

Steve Brown

In article <45b1dd72$0$92122$dbd4b001 (AT) news (DOT) wanadoo.nl>, "Ursus"
ursus.kirk (AT) wanadoo (DOT) nl> wrote:

Remi-Noel,

I know that a file, once referenced, is regarded as active. (Which is not
quite the same as open). An open file can be seen in the
menu>windows>bottom
part. An active file, although referenced by filemaker does not appear
anywhere. My guess now is that allthough the script-step to perform the
external script has not been triggered yet, FileMaker somehow has veryfied
the link to the script. This link is to the old file which need replaced.
But by checking filemaker has made the file active (not yet open).

I have drawn this conclusion after trying several command-line options,
and
getting an error back that the file already is referenced. I do know about
troy, but these are pretty expensive and would not solve the
already-active
problem. I am currently looking into vbs and for osx creating an
applescript. I rather do it automaticaly, I fear that when I instruct my
users to have to empty the table they will forget or not understand and
just
not do it.

ursus

"Remi-Noel Menegaux" <rnmenegaux_AT_free.fr> schreef in bericht
news:45b1ba53$0$31042$426a34cc (AT) news (DOT) free.fr...
I read what Howard and you said on this subject : I didn't understand it
all, though.
All I wish to add is that - as it has been for long not obvious to me -
that as soon as a file is 'open' in FileMaker (maybe through an old
relationship somewhere) it is considered as 'activated' even if you do
not
use it at the moment.
Perhaps, it's the reason why you can't delete it. If so, you may 'close'
it, just in case (?).
By the way, the Troi File plugin - and others - can delete a file and
even
folders from within a script.
Remi-Noel

"Ursus" <ursus.kirk (AT) wanadoo (DOT) nl> a écrit dans le message de news:
45b13cde$0$43971$dbd45001 (AT) news (DOT) wanadoo.nl...
Well Howard here we are stuck with the same problem as with my previous
link about error capture.

I have tried the /k option and it says that the file is already in use
by
an other process. It is NOT in the list under Window, but somehow
filemaker has activated the file.

Ursus


"Howard Schlossberg" <howard (AT) antispahm (DOT) fmprosolutions.com> schreef in
bericht news:12r1vlpte0jlhe7 (AT) corp (DOT) supernews.com...
I just tried your first script and it worked with no problem.
Nonetheless, I'm not sure why you are bothering with the
$CurrentFileName
and the substitution, since that really has nothing to do with
anything.

Try running the Send Event step with "cmd /k del " & $DeleteFile. By
using the /k flag, you will be able to see the DOS dialog and any
error
messages that get generated. My guess is that your target file is
already open in FMP and can therefore not be deleted.


Ursus wrote:
Fmp 8.5 adv, winXP

I want to delete a file through a script. Here is what I have tried
without result.

MyFile.fp7 and MyOldFile.fp7 are in the same directory. I am working
from MyFile.

Set variable [$CurrentPath; Value:Get ( FilePath )]
Set variable [$CurrentFileName; Value:Get ( FileName)]
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "MyOldFile.fp7"]; ["file:/" ; "" ] ;
["/"; "\\"] ) ]
Send Event ["aevt"; "odoc"; "cmd /c del " & $DeleteFile

which does evoke the commandline, but has no result.

I have tried:
Set variable [$DeleteFile; Value: Substitute ( $CurrentPath ; [ "/" &
$CurrentFileName & ".fp7"; "/" & "FotoKopie.fp7"]; ["file:/" ;
"" ] ) ]
Without any result

When I view the $DeleteFile with the Data Viewer all looks well, the
final variable $DeleteFile does contain the correct path and
filename.
(Both with \ or / tried)

What next?

Ursus

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.