I have shared procedure files on the network that need to be automatically loaded and incorporated (adopted) in the experiment. The standard #include directive does not do this. Manually, I can adopt a procedure using "File", "Adopt Procedure...". But how can do this automatically? Does this functionality exist? Is there a better way to do what I want: import a procedure file and sever the connection to the original?
If this feature does not exist, could you create a special "adopt" flag to the #include directive?
I'm not sure why you would want to do what you describe, but the Igor 6.30B01 beta (due out in a few weeks) has an AdoptFiles/UP command which you could cause to run from a macro to adopt procedure files.
The AdoptFiles operation adopts external files and waves into the current experiment. This operation cannot be called from a function unless via Execute/P.
Flags
/A Adopt all external notebooks and user procedure files and all waves starting at the root data folder. WaveMetrics Procedure files are not adopted. Equivalent to /NB/UP/DF.
/DF Adopt all waves saved external to the experiment.
/DF=dataFolderPathStr Adopt all waves saved external to the experiment that are in the specified data folder.
/I Show the Adopt All dialog and adopt what the user selects there.
/NB Adopt all external notebook files.
/UP Adopt all external user procedure files.
/WP Adopt all WaveMetrics Procedure procedure files.
/WV=wave Adopts only the specified wave.
Details
Only files and waves saved externally to the experiment are adopted.
The number of objects actually adopted is returned in V_Flag.
When the experiment is next saved, the files and waves are saved in the experiment file, and any link to the files is lost.
To adopt just one wave, use AdoptFiles/W=wave0.
To adopt just one window use DoWindow/F and DoIgorMenu "File", "Adopt Window".
Macro Examples
AdoptFiles/I// Show the Adopt All dialog. AdoptFiles/DF // Adopt all externally saved waves. AdoptFiles/A/WP // Adopt everything that can be adopted. AdoptFiles/DF/NB/UP/WP // Adopt everything that can be adopted. AdoptFiles/DF=root:subfolder // Adopt any externally saved waves in root:subfolder. AdoptFiles/WV=wave0 // Adopt wave0 if it is saved externally.
Function Examples
Execute/P"AdoptFiles/A"// schedule adoption of all user files and waves Execute/P"AdoptFiles/WV="+GetWavesDataFolder(w,2)// schedule adoption of wave w
See Also
Adopt All, Adopting Notebook and Procedure Files, Avoiding Shared Igor Binary Files, WinList, Operation Queue.
1. The network connection is often lost, and thus procedure windows for external procedures indicate: "ERROR: Windows OS error - access denied".
2. I want to be able to modify procedures without affecting the original procedure file from which they were loaded.
I can now solve these problems by having an experiment template which loads the procedure file once from the network and then adopts it into the experiment.
PS Can't wait for the new version! Congratulations on another (pre)release.
Stay tuned; Igor 6.30B01 will be announced in the News and Announcements forum here: http://www.igorexchange.com/forum/69
In fact, you can get it now on the "Nightly Build" page: http://www.wavemetrics.net/Downloads/latest/
Here's the AdoptFiles syntax:
AdoptFiles [/I /A /NB /UP /WP /DF[=dataFolderOrWavePathStr]/WV=wave ]
The AdoptFiles operation adopts external files and waves into the current experiment. This operation cannot be called from a function unless via Execute/P.
Flags
/A Adopt all external notebooks and user procedure files and all waves starting at the root data folder. WaveMetrics Procedure files are not adopted. Equivalent to /NB/UP/DF.
/DF Adopt all waves saved external to the experiment.
/DF=dataFolderPathStr Adopt all waves saved external to the experiment that are in the specified data folder.
/I Show the Adopt All dialog and adopt what the user selects there.
/NB Adopt all external notebook files.
/UP Adopt all external user procedure files.
/WP Adopt all WaveMetrics Procedure procedure files.
/WV=wave Adopts only the specified wave.
Details
Only files and waves saved externally to the experiment are adopted.
The number of objects actually adopted is returned in V_Flag.
When the experiment is next saved, the files and waves are saved in the experiment file, and any link to the files is lost.
To adopt just one wave, use AdoptFiles/W=wave0.
To adopt just one window use DoWindow/F and DoIgorMenu "File", "Adopt Window".
Macro Examples
AdoptFiles/DF // Adopt all externally saved waves.
AdoptFiles/A/WP // Adopt everything that can be adopted.
AdoptFiles/DF/NB/UP/WP // Adopt everything that can be adopted.
AdoptFiles/DF=root:subfolder // Adopt any externally saved waves in root:subfolder.
AdoptFiles/WV=wave0 // Adopt wave0 if it is saved externally.
Function Examples
Execute/P "AdoptFiles/WV="+GetWavesDataFolder(w,2) // schedule adoption of wave w
See Also
Adopt All, Adopting Notebook and Procedure Files, Avoiding Shared Igor Binary Files, WinList, Operation Queue.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
May 16, 2012 at 11:16 am - Permalink
I have two reasons why I need this functionality:
1. The network connection is often lost, and thus procedure windows for external procedures indicate: "ERROR: Windows OS error - access denied".
2. I want to be able to modify procedures without affecting the original procedure file from which they were loaded.
I can now solve these problems by having an experiment template which loads the procedure file once from the network and then adopts it into the experiment.
PS Can't wait for the new version! Congratulations on another (pre)release.
May 23, 2012 at 05:31 am - Permalink