Hi thank you for your help I have gotten a little further with this script, I probably should have explained the entire scope of the script so that you might have had a better understanding of what I need to do, rather than just the part that I was having trouble with.
The task I'm trying to accomplish is to insert a number of thumbnails and a web address link on the same row that a sku # appears in a Excel 2016 document. The sku number or a fairly close approximation of it appears in the name of the web page on our web server and in the thumbnail file names I will use to insert into the excel doc.
So far thanks to your help I have been able to write out a csv file from the excel doc and form this into a find command that gives me the proper file name for the web page and thumbnails for each sku item.
This is the point where I am little out of my depth and could use a suggestion of what is the best way to accomplish what I need to do next.
I have the the row number and the filename of the matching sku saved in a file I also have a osascript to place the thumbnails and weblink
What I need to do is insert the $ROW_NUMBER and $SKU_NAME into the osascript where they need to be and save the file off with the values expanded into there proper names
Directly below is an example of the file with the $ROW_NUMBER and proper file name of the $SKU_NAME variables, the "tLINE" copy is just a placeholder that I use to make it easier to manipulate the file if I need to, the number at the front of the line is the actual row number
2tLINE 488906_001_Winter_NY_Produce_End_Cap_Bunker_ATL_Agri-Growers_36x19.5_E_F
3tLINE 488906_002_Winter_NY_Produce_End_Cap_Bunker_ATL_Agri-Growers_36x19.5_E_F
4tLINE 488906_003_Winter_NY_Produce_End_Cap_Bunker_ATL_Scotia-Gold_36x19.5_E_F
Below is the osascript I am using
osascript <<EOD
tell application "Microsoft Excel"
activate
make new hyperlink of cell "B$ROW-NUMBER" at active sheet with properties {address:"http://switchauto.tigroup.ca/SCL_Preflight_Report_Page/$SKUNAME_report.html"}
set theLeft to left position of cell "A$ROW-NUMBER"
set theTop to top of cell "A$ROW-NUMBER"
set currentWorkbook to workbook 1
tell currentWorkbook
tell worksheet 1
set pictureShape to make new shape at the beginning with properties {height:"72", width:"72", left position:0, top:theTop, placement:placement move}
user picture pictureShape picture file "Macintosh HD:Library:WebServer:Documents:FilesForExcel:Jpeg:$SKU-NAME_02.jpeg"
end tell
EOD
I was hoping to use an array although I'm not sure if this is the most direct way to go about this.
The part that is giving me trouble today is that if I use an array I do not know If i can have more than one value for "i", I have two values the ROW-NUMBER and the SKUNAME that need to populate during the same iteration, is this even possible?
If you know of another way to go about this I would be happy to give it a try.
Apple script doesn't have any grep like functions although you can call a shell script that will do that for you, I was thinking that if I need to use a shell script to accomplish what I need, that I would do as much in the shell as I could, seeing as I am not very comfortable with applescript to start with.
Thank you for your time and patience.