ScriptSpot home

Forum topic · Scripts Wanted

copy all layer names to clipboard

By harumscarum · 2015-12-11

Description

would be very useful to have script which copy all layer names to clipboard
like this

ENV_buildings
ENV_curbs
ENV_details
ENV_furniture
ENV_grass
ENV_pavements
ENV_pools
ENV_roads
ENV_sand
ENV_sea
PLANT_shrubs
PLANT_trees

thanks in advance

Comments (10)
harumscarum

cool! thank you very much

harumscarum

same for selected ojects

could it be updated to copy to clipboard names of all selected objects, alphabetically

thanks

Reply to harumscarum
Panteleev Sergey

.

see if it works. I didn't test it in max


(
	names = for s in selection collect s.name
	qsort names stricmp
	ss = stringstream ""
	for n in names do format "%\n" n to:ss
	SetClipboardText ss
)
Eva Visnjic

Just what I needed. Thanks for the update.
Eva Visnjic

harumscarum

sort alphabetically

happy new year!
there is two little request if possible:
copy layers in alphabetical order
and add three spaces in the start of each row. like this:
   ENV_buildings
   ENV_curbs
   ENV_furniture

 

big thanks in advance
regards, viktor

Reply to harumscarum
Branko Živković


macroscript CopyToClipboardLayerList
category:"bga"
tooltip:"TOOLTIP NEEDED"
buttonText:"TEXT NEEDED"
(
fn copyToClipboardLayerList includeZero:off sorting:on =
(
e = if includeZero then 0 else 1
string = ""
if not sorting then
(
for i = e to layermanager.count-1 do string += (" " + (layermanager.getlayer i).name + "\n")
)
else
(
array = sort (for i = e to layermanager.count-1 collect (" " + (layermanager.getlayer i).name))
for str in array do string += (str + "\n")
)
setClipBoardText string
)

-- if argument "includeZero" is ON then Zero layer will be included in the string list or exclude zero layer with OFF (default is off)
copyToClipboardLayerList()
)

harumscarum

thank you very very much!

harumscarum

thank you very much. i tried to make it work as shortcut, didn't work for me. please hint me how to complete it

regards
viktor

.

This works for me:


macroscript CopyToClipboardLayerList
category:"bga"
tooltip:"TOOLTIP NEEDED"
buttonText:"TEXT NEEDED"
(
	fn copyToClipboardLayerList includeZero:off =
	(
		e = if includeZero then 0 else 1
		string = ""
		for i = e to layermanager.count-1 do string += ((layermanager.getlayer i).name + "\n")
		setClipBoardText string
	)
 
	-- if argument "includeZero" is ON then Zero layer will be included in the string list or exclude zero layer with OFF (default is off)
	copyToClipboardLayerList()
)
Branko Živković

This is the FN


fn copyToClipboardLayerList includeZero:off =
(
e = if includeZero then 0 else 1
string = ""
for i = e to layermanager.count-1 do string += ((layermanager.getlayer i).name + "\n")
setClipBoardText string
)

-- if argument "includeZero" is ON then Zero layer will be included in the string list or exclude zero layer with OFF (default is off)
copyToClipboardLayerList()