Thank you for your response Dan,
I did, but I am getting confused when making a layer file from table of content, because if I run it manually, the script will only adding 1 band instead of 3 composite band, so I need a trigger to make a layer.
Is it possible for me to making an automize script that will adding the raster layer of my directory file without any trigger?
Here is my code :
import arcpy, os, glob, pythonaddins
import Tkinter as tk
import tkFileDialog as filedialog
mxd = arcpy.mapping.MapDocument("Current")
mxd.author = "Me"
mxd.save()
root=tk.Tk()
root.withdraw()
folder_selected = filedialog.askdirectory()
root.destroy
# mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
file_name=[]
for file in os.listdir(folder_selected😞
if file.endswith(".tif"😞
file_name.append(file)
# arcpy.mapping.AddLayer(df, arcpy.mapping.Layer(os.path.join(folder_selected,file_name[0])))
for lyr in arcpy.mapping.ListLayers(mxd😞
lyr.saveACopy(file_name[0] + ".lyr")
source_layer = arcpy.mapping.Layer(os.path.join(folder_selected,(file_name[0] + ".lyr")))
count = 0
for file in os.listdir(folder_selected😞
if file.endswith(".tif"😞
name = file.split(".")[0]
rasterPath = os.path.join(folder_selected,file)
update_layer = arcpy.mapping.Layer(rasterPath)
arcpy.mapping.UpdateLayer(df, update_layer, source_layer, True)
arcpy.mapping.AddLayer(df,update_layer,"BOTTOM")
count = count + 1