TK-Fileload from last Directory

Q&A's, tips, howto's
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

TK-Fileload from last Directory

Post by HPW »

A little modification in newlisp-tk.tcl allows the Fileopen-Dialog to open in the lastLoadedFile-directory by adding a '-initialdir $lastLoadedFile'

Code: Select all

proc LoadFile {} {

	global statusText FileTypeList lastLoadedFile remoteFlag

	if {$remoteFlag == 0 } {
		set spec [tk_getOpenFile -title "Load a newLISP source file" \
			-filetypes $FileTypeList -initialdir $lastLoadedFile]
	} else { FileDialog "load" "Load a newLISP source file" . ; return }
		

	if { $spec == "" } { return }

	set cd [file dirname $spec]

        NewlispEvaluate "(silent (load \"$spec\") (change-dir \"$cd\"))"

        set lastLoadedFile $spec
	set statusText "Loaded file $spec"
	}
Maybe a matter of personal taste, but I find it annoying that it always go back to c:\newlisp.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Thanks, I will put this in a next version

Lutz

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

8.2.1 still on tk 1.17 without -initialdir $lastLoadedFile!
;-)
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

just got it in now for 1.18

Lutz

Locked