Suggesting a path for loading waves
andreponzoni
I did a procedure a long time ago, to load waves from a folder. The procedure is working fine, but with time my amount of date is getting bigger with loads of folders and subfolders. So it is a nightmare for me select the correct folder in the middle of the mess.
The good thing is that 90% of the times I need the waves that are always in the same folder, so I would like to know if is possible to suggest this folder as DEFAULT folder for that window that appear asking selection.
I've tryed to define newpath/o temporarypath, path , but when I do that, the selecting window does not appear...
So, is there any way to suggest that?
function loadfit()
string filename=""
string pathname=""
newpath/o temporaryPath
if (v_flag!=0)
return -1
endif
pathname= "temporarypath"
/// Proceed to the loading waves from the selected folder!
string filename=""
string pathname=""
newpath/o temporaryPath
if (v_flag!=0)
return -1
endif
pathname= "temporarypath"
/// Proceed to the loading waves from the selected folder!
- If it's Igor folders you are talking about, then moving the little red arrow to the left of the folder symbol in the Data Browser will set a folder (where the arrow is pointing to) to the starting folder for functions and dialog windows within Igor.
- If you are talking about folders in Windows (or Mac?), then usually saving a file from within Igor will set this folder as starting point for future save and load dialogs. Unfortunately, I don't know another way of triggering this behavior without saving involved.
January 30, 2015 at 04:13 am - Permalink
In the meantime maybe you want to have a look at the /P flag from loadwave:
HJ
January 30, 2015 at 04:51 am - Permalink
January 30, 2015 at 08:26 am - Permalink
Okay Guys.. I will try to explain a bit better! Sorry for that.. that's what happens when a non english speaker have to write in a rush !
First of all, I have a procedure that I wrote a long time ago for loading WAVES from TXT files inside any windows folder! The procedure works really fine, and that's not wrong with it... I just would like to make my life easy by saving time selecting the correct folder.
I have my data saved something as this:
Procedure
C:\Procedure Folder\File.ipf
TXT file for loading waves
C:\Folder\SubFolder\SubFolder\SubFolder\SubFolder\............\SubFolder\Myfiles.txt
So, everytime that I use my procedure appears a window asking me to choose a folder to load the files from... and the selected folder at the window is always the Procedure's Folder!
Once 90% of the times I have to load files from the same folder, I was wondering if is possible to tell Igor to use that path as a initial choice instead of the procedure folder!
Hope you guys understand now!
Thanks again
Andre
January 31, 2015 at 07:52 am - Permalink
...
String OpenPath=S_FileName
LoadWave /O/A /B=("C=1,F=0,N=CalData; C=1,F=0,N=QMSData;") /J /Q S_FileName
...
NewPath /O /Q CalDataPath RemoveEnding(OpenPath,S_FileName)
Please ignore the details - You just want to use
newpath
with the path from the open dialogue. Be aware if s_filename carries a path or not in your procedure.(In this example I'm first loading a header and afterwards the two waves)
HJ
February 1, 2015 at 03:28 pm - Permalink
This sounds like you want to have the path available when you run your procedure in a new experiment. If this is the case, you will need to hard code the file path in your procedure possibly using
Strconstant
or useSavePackagePreferences & LoadPackagePreferences
to save the path to the computer's hard disk. The latter is more complex, but offers the ability to update the saved path. There is a WaveMetrics example experiment for the latter technique that can be loaded from the File menu: File > Example Experiments > Programming >Package Preferences Demo.February 2, 2015 at 05:49 am - Permalink