Copy document path+name to clipboard

A method/tool/button to copy document path+name to the clipboard.

Easy idea:

The text can’t be selected, unlike most OS dialogs, so there’s no way to copy it from here.

Found a ‘solution’ by using DocumentText.
Not very obvious.
I still wish for a simpler method.

1 Like

One solution could be to copy the file path from windows file explorer (right click on the file and Copy Path);
Another way could be to use this script in a button.
Hope this can solve.

Option Explicit
'Script written by Lucio Zadra
'Script copyrighted by Zadra Giuseppe
'Script version martedì 9 gennaio 2024 12:45:34

Call Main()
Sub Main()
	Dim StrFileName, StrFilePath
	StrFileName = Rhino.DocumentName
	If IsNull(StrFileName) Then
		Rhino.MessageBox "No File Name to copy to clipboard."
		Exit Sub
		StrFilePath = Rhino.DocumentPath
		Rhino.ClipboardText StrFilePath & StrFileName
	End If
End Sub

Or Python:

import rhinoscriptsyntax as rs
import os

if filepath:
    print ("File path+name copied to clipboard")
    print ("File has not been saved, no document path available")
1 Like