Sponsored Content
Top Forums Shell Programming and Scripting Exanding an array into another file. Post 303027339 by Paul Walker on Thursday 13th of December 2018 04:22:55 PM
Old 12-13-2018
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

Code:
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
Code:
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create array holding characters from sring then echo array.

Hi, I wish to store $string1 in $string1array a character in each array element. Then i wish to echo the entire array to the screen so that it reads as the normal string again. I have been trying with the code below but does not work. Please help... To put string into array: ... (5 Replies)
Discussion started by: rorey_breaker
5 Replies

2. Programming

Creating an array to hold posix thread ids: Only dynamic array works

I am facing a strange error while creating posix threads: Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output. Snippet 1 This works: -------------- int *threadids; threadids = (int *) malloc (num_threads * sizeof(int)); ... (4 Replies)
Discussion started by: kmehta
4 Replies

3. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

4. Shell Programming and Scripting

perl, put one array into many array when field is equal to sth

Hi Everyone, #!/usr/bin/perl use strict; use warnings; my @test=("a;b;qqq;c;d","a;b;ggg;c;d","a;b;qqq;c;d"); would like to split the @test array into two array: @test1=(("a;b;qqq;c;d","a;b;qqq;c;d"); and @test2=("a;b;ggg;c;d"); means search for 3rd filed. Thanks find the... (0 Replies)
Discussion started by: jimmy_y
0 Replies

5. Shell Programming and Scripting

Array in Perl - Detect several file to be in one array

Hi everyone I have one question about using array in perl. let say I have several log file in one folder.. example test1.log test2.log test3.log and the list goes on.. how to make an array for this file? It suppose to detect log file in the current directory and all the log file will... (3 Replies)
Discussion started by: sayachop
3 Replies

6. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

7. Shell Programming and Scripting

Compare file to array, replace with corresponding second array

ok, so here is the issue, I have 2 arrays. I need to be able to create a loop that will find ${ARRAY1 in the text doc, and replace it with ${ARRAY2 then write the results. I already have that working. The problem is, I need it to do that same result across however many items are in the 2... (2 Replies)
Discussion started by: gentlefury
2 Replies

8. Shell Programming and Scripting

Bash 3.2 - Array / Regex - IF 3rd member in array ends in 5 digits then do somthing...

Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help. pesudo code if == ENDSINFIVEINTS ]]; then do... (4 Replies)
Discussion started by: briandanielz
4 Replies

9. Shell Programming and Scripting

Search if file exists for a file pattern stored in array

Hi experts, I have two arrays one has the file paths to be searched in , and the other has the files to be serached.For eg searchfile.dat will have abc303 xyz123 i have to search for files that could be abc303*.dat or for that matter any extension . abc303*.dat.gz The following code... (2 Replies)
Discussion started by: 100bees
2 Replies

10. Shell Programming and Scripting

Bash arrays: rebin/interpolate smaller array to large array

hello, i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N. for case 1, I want to stretch N to fit M arrayHuge H = (... (2 Replies)
Discussion started by: f77hack
2 Replies
JIGL(1) 						      General Commands Manual							   JIGL(1)

NAME
jigl - Generates a static html photo gallery from one or more directories of images SYNOPSIS
jigl [ options ] [ directory ] [ directory ... ] DESCRIPTION
jigl (pronounced jiggle) is a perl script that generates a static html photo gallery from one or more directories of gif/jpg/png images. It supports themes and is very customizable. It includes the ability to display comments and EXIF info for each image in a simple clean lay- out. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For further details, see the documentation in /usr/share/doc/jigl/ -h, --help Show summary of options. -v, --version Show version of program. -cg --create-gallerydat Create a gallery.dat file and exit -uec --use-exif-comment Use the comment field in the exif header (if it exists) as the slide comment. This will overwrite the description that is written in a gallery.dat file. If used in conjunction with the -cg option, the comment field will be saved in the gallery.dat file. Default is DISABLED. (can be negated). -rs --replace-spaces <a|y|n> Replaces spaces with underscores "_" in filenames. a -- (default) Ask the user if they want to y -- replace and do no ask n -- do not replace and do no ask -it --index-title <string> Sets the title and title-bar of the index.html page to string. This is meant to be used when you are not using a gallery.dat file. -iw --index-width <1-255> How many thumbnails per line you want on the index page. Default is 5 -ir --index-row <0-255> The number of thumbnail rows you want on the index page before a new index page is generated. If 0, there is no limit and only one index page will be generated. Default is 0 -ut --update-templates Remove the template files from the local directory and the global default theme directory. This will cause new default template files to be generated in the global default theme directory. Default is DISABLED. (can be negated). -ft --force-thumb Force thumbnail regeneration (can be negated) -fs --force-slide Force slide regeneration (can be negated) -skb --slide-kbsize Print the file size of the slide on the index page under the thumbnails. Default is ENABLED (can be negated) -sxy --slide-xysize Print the slide dimensions under the thumbnails on the index page. Default is ENABLED (can be negated) -uo --use-original Use the original images for the slides - do not generate a scaled slide image. Default is DISABLED. (can be negated) -lo --link-original Link to the original images from the slides. Default is DISABLED. (can be negated). -aro --auto-rotate-originals Do a lossless rotation of the original images. This option is only useful if your digital camera sets the Orientation field in the EXIF header. All EXIF header information will be kept and the Orientation field will be updated to reflect the rotation. Default is DISABLED. (can be negated). -gs --generate-slides Gererate slide pages and link them to the thumbnails. If this option is turned off, slides will not be generated and the info pages will be linked to the thumbnails instead. If neither slide or info pages are generated, the thumbnails will not link to anything. Default is ENABLED. (can be negated). -gi --generate-info Generate info pages and link them to the "info" link on the slide pages. If this option is turned off, info pages will not be gener- ated and the "info" link on the slide pages will dissapear. If no slides are generated, then the info pages will be linked directly to the thumbnails. Default is ENABLED. (can be negated). -sy --slideY <int> Maximum size of slide image in the Y direction. If the height of the original image is greater than this value the slide will be scaled to this value. Otherwise the slide is simply a copy of the original. Default is 480 pixels -ty --thumbY <int> Size of the scaled thumbnail image in the Y direction Default is 75 pixels -iy --infoY <int> Maximum size of the info image in the Y direction. This is simply a scale of the slide image using HTML height and width tags. A new image is not generated. Default is 240 pixels -ws --watermark-slides Enable watermarking of the slide images. A watermark file must be present for this option to work. Default is DISABLED. (can be negated). -wf --watermark-file <filename> Name of the watermark file to use when -ws is enabled. Default is "watermark.png". -wg --watermark-gravity <north|south|east|west|northeast|northwest|southeast|southwest> Where to display the watermark on the slide. Default is southeast. -gb --go-back Prepend a "Go Back" link to the header in the index.html file. If used in conjunction with -cg, the Go Back link will be added to the INDEX-HEADER tag in the newly created gallery.dat file. Default is DISABLED. (can be negated). -gbs --go-back-string <string> String to use for the go-back-url link. You could even make this an image to help round out a theme by making this string something like: "<img src=theme/myimage.gif border=0>" Default is "Go Back". -gburl --go-back-url <url> URL to use when -gb is enabled. Any URL can be used. Default is '..', the previous directory. --theme <themeName> Name of theme to use. Themes files are defined as "themeName.theme". You would just enter the "themeName" portion of the file. Default is "default". -wd --web-dir <dir> Directory to put all the gallery files (html, slides, thumbnails and possibly theme files) into. Unless a fully qualified path is used, this directory will be created in the current directory. This option is not used if the -lo or -uo option is set. Default is "web". -r --recurse Recurse through all directories on the command line. This option will omit all directories named "slides", "thumbs", "theme", "web" and the value of -wd if that option is set. This option will ONLY be recognized from the command line to help prevent accidents. Note: Any options listed on the command line when using recursion will be applied to all directories. Default is DISABLED. -h --help Display this information and exit -v --version Display version and exit -d --debug <0-5> Set debug level. Default is 0 [directories] Directories to process. Default is . (current). Note: If an option listed says it can be negated you can prefix it with "no" and the opposite effect will happen. Useful for overriding options on the command line that are set elsewhere. e.g. -nouo | --nouse-original will NOT use the original files as slides. SETTING OPTIONS
Options can be used in any of three places: (listed ascending precedence) -- A single line in the $HOME/.jigl/jigl.opts file in the users home directory. -- After the GAL-OPTIONS tag as a single line in the gallery.dat file in each of the album directories. -- On the command line. Regardless of where they are located, they should all be listed in the same form as you would use them on the command line. Example: -lo -iw 6 -noskb Theme files can be located in either the directory jigl is processing or in the .jigl directory in the user's home directory. AUTHOR
jigl was written by Jason Paul <jigl@xome.net>. Its project page is located at http://xome.net/projects/jigl/. This manual page was adapted from the program help text by Nicholas Breen <nbreen@ofb.net> for the Debian project (but may be used by oth- ers). October 8, 2006 JIGL(1)
All times are GMT -4. The time now is 08:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy