elicit user input to define save path

Hello,

I would like to make the function below save all waves to a path I define without asking each time for the folder for each wave.
Thanks for your time.

 

Function SaveWavesFromCurrentDF(matchStr)

String matchStr 

	String list
	list = Wavelist(matchstr,";","")
	NewPath/O pathUserSelected, "C:Users"
	Save/O/C/W/I/B /P= pathUserSelected list

End
The /I flag tells Save to display a dialog so remove that.

Set the path to a folder for which you have write access. In my case "C:Users:Howard" works.
Hello,

I don't want to remove the dialog box because I would like the user to choose where to save the waves. When I remove the I/ flag then the save location has to be prespecified in the script which I don't want, because it will change.
I think what you are saying is that you want the user to choose the folder once and save all of the waves there. If that is the case then do this:


Function SaveWavesFromCurrentDF(matchStr)
	String matchStr 
 
 	String list
	list = Wavelist(matchstr,";","")
	Variable numWaves = ItemsInList(list)
	if (numWaves == 0)
		Print "No waves matched"
		return -1
	endif

	NewPath /O pathUserSelected			// Let the user choose the path
	if (V_flag != 0)
		Print "Cancelled"
		return -1				// User cancelled
	endif
	
	Save/O/C/W/B /P=pathUserSelected list

	Printf "%d waves saved\r", numWaves
	
	return 0		// Success
End