Suppress Dialog with SavePICT
pczjrh
I have a loop that loads data from a file then plots it up (via another routine).
Is there anyway to suppress the Save Diaglog box - I have to press return every time the graph is plotted.
Not sol bad if I have 10 to plot, but not a few hundred!
Everything works, the right folder is selected, the filename is right, just I have to confirm it.
Snippet of code with loop section
For (i=0;i<NOI;i+=1)
FolderName = "Number"
CurrentFile = text_wave[i]
FolderName = FolderName + num2str(i)
NewDataFolder/O/S $FolderName
LoadWave/A=Wave/J/L={0,10,0,0,0} CurrentFile
PlotMyData()
String FileName = FolderName + ".png"
SavePICT/O/E=-5/B=72/P=S_Path as FileName
KillWindow Graph0
SetDataFolder Root:
Endfor
FolderName = "Number"
CurrentFile = text_wave[i]
FolderName = FolderName + num2str(i)
NewDataFolder/O/S $FolderName
LoadWave/A=Wave/J/L={0,10,0,0,0} CurrentFile
PlotMyData()
String FileName = FolderName + ".png"
SavePICT/O/E=-5/B=72/P=S_Path as FileName
KillWindow Graph0
SetDataFolder Root:
Endfor
Thanks for all for your help,
Jason.
If I understand, you likely need to create the graph with its KILL flag set to something other than 0. I have substituted the Display command for your PlotMyData() function call. Instead, I would call a LayoutMyGraph() function after the Display. This keeps it clear exactly where you have created the graph that you later kill.
for (i=0;i<NOI;i+=1)
CurrentFile = text_wave[i]
sprintf FolderName, "Number%d", i
sprintf FileName, "%s.png" FolderName
SetDataFolder $FolderName
LoadWave/A=Wave/J/L={0,10,0,0,0} CurrentFile
Display/K=1 ... CurrentFile as "MyData"
LayoutMyGraph()
SavePICT/O/E=-5/B=72/P=S_Path as FileName
KillWindow Graph0
SetDataFolder root:
endfor
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
February 4, 2011 at 05:59 am - Permalink
The problem is the "Save Graphic As:" dialog box invoked by the SavePICT command.
I thought by providing both the path and filename that this would not appear, but it still does.
Like I said, everything is filled in ready to go, just I have to physically press the Return key.
The KillWindow command bypasses the graph recreation procedure and closes the window without complaint.
Cheers,
Jason.
February 4, 2011 at 06:09 am - Permalink
In your case you will be better off using a full path:
Print fullPath // For debugging only
SavePICT/O/E=-5/B=72 as fullPath
February 4, 2011 at 06:57 am - Permalink
Cheers,
Jason.
February 7, 2011 at 03:30 am - Permalink
Dear all.
I am trying to save a series of graphs more than 5000 to make a movie on Igor64 for mac. Based on the above discussion, I wrote the code as,
pathName = "/Users/...../"
fileName = num2str(i)+".jpg"
fullPathName = pathName + fileName
SavePICT/O/E=-6 as fullPathName
But still I got a dialog box to confirm the file saving. Actually I tried various combinations of expressions to specify the absolute file path but I have failed to suppress the appearance of the dialog box. Would someone save me from the hell of endless Return key pressing?
Kaz
July 8, 2020 at 07:25 am - Permalink
Your call has two problems:
DisplayHelpTopic "Path Separators"
July 8, 2020 at 08:03 am - Permalink
On Macintosh a full path starts with a volume name and uses colon separators. For example, "hd:Users:Me:Test.jpg".
On Windows a full path starts with a drive letter or UNC name and uses colon separators. For example, "C:Users:Me:Test.jpg". You can use backslashes instead of colons but you must escape them. See the help topic mentioned by chozo above for details.
I recommend using a symbolic path rather than full paths. Execute this for details:
DisplayHelpTopic "Symbolic Paths"
July 8, 2020 at 10:54 am - Permalink
Thank you very much for your pointed advice.
(1) the full pathname should include a drive name
(2) path separator for mac is ":" instead of "/"
(3) special characters such as "space" can be used directly in the pathname
wrong: "Users/xxx/yyy\ yy/"
correct: pathName = "Macintosh HD:Users:xxx:yyy yy:"
I could successfully create a series of graph files.
I frequently use unix side of mac so I just "copy and paste" the file path from the terminal app to igor(pro), although I have written many codes on igor(pro).
Many thanks again,
Kaz
July 8, 2020 at 07:55 pm - Permalink
FWIW, you can convert from a Posix path to an HFS path (using colons) using ParseFilePath:
•Print hfsPath
hd:Applications:Utilities
This requires Igor Pro 7.00 or later.
July 9, 2020 at 07:12 am - Permalink
Dear hrodstein
Thank you for your advice. I never realized such a useful command.
Kaz
July 19, 2020 at 09:32 pm - Permalink