i am new to Applescript i don't how to use fit artboard to selected art, Can any one help me
this does what your after, no need to select items.
tell application "Adobe Illustrator"
tell document 1
set SelectedArt to visible bounds
set artboard rectangle of artboard 1 to SelectedArt
Retrieving data ...