If you are in the tcl shell and your Quartus project is already opened you can obtain the information in the quartus array from the global name space:
for example: # array names quartus ip_rootpath copyright load_report_is_needed advanced_use nativelink_tclpath quartus_rootpath processing tclpath ipc_mode nameofexecutable natural_bus_naming eda_tclpath settings internal_use regtest_mode package_table eda_libpath args ipc_sh version binpath project is_report_loaded available_packages
# puts $quartus(project) If you are loading a script from your .qsf file
for example:
set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:myscript.tcl"
then the project file name is automatically passed to your script as the first argument:
proc main {} {
package require cmdline
# # Global Variables
global ::argv
set project_name [lindex $argv 1]
...
}
Alain