![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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 |
#7
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |