Hi thank you very much! that worked, but I was wondering if there is a better way to go about this?
You suggested to use a flat file. I'm not sure I understand, would that be to already perform the substitution of the variables with something like sed?
The osascript is used save the Excel file as a tab delimited file which I will use in another script.
The array comes form a list of files that are submitted through a hot folder.
Directly below is the script I use to format the array and move the files from one folder to another to be worked on.
Is there a way to call the osascript from the script I use to format the array, and write out my osascript file with the proper file names (your suggestion worked fine I just wondered if there is a more direct way).
Or is there a way to run the osascript in such a way that the shell can parse the variables in the array and pass it to the osascript?
Thank you very much for your help!!
Code:
while true
do
cp /Osascript_ForExcel_Shapes/Kernel/Standing_filelist_array /Osascript_ForExcel_Shapes/Kernel/filelist_array
ls /Osascript_ForExcel_Shapes/ExcelThumbs >> /Osascript_ForExcel_Shapes/Kernel/filelist_array
sed -i '' -e s'/^/\"/g' /Osascript_ForExcel_Shapes/Kernel/filelist_array
sed -i '' -e s'/\"declare/\declare/g' /Osascript_ForExcel_Shapes/Kernel/filelist_array
sed -i '' -e s'/\"filelist/\filelist/g' /Osascript_ForExcel_Shapes/Kernel/filelist_array
sed -i '' -e s'/\.xlsx/\"/g' /Osascript_ForExcel_Shapes/Kernel/filelist_array
awk '1; END {print ")"}' /Osascript_ForExcel_Shapes/Kernel/filelist_array > tmp && mv tmp /Osascript_ForExcel_Shapes/Kernel/filelist_array
source //Osascript_ForExcel_Shapes/Kernel/filelist_array
for i in "${filelist_array[@]}"
do
mv /Osascript_ForExcel_Shapes/ExcelThumbs/"$i".xlsx /Osascript_ForExcel_Shapes/Working/
done
Below is the full osascript to save as tab delimited "FILENAME" is name of the original Excel files.
Code:
osascript <<EOD
tell application "Microsoft Excel"
activate
set theWorkbookFile to "Macintosh HD:Osascript_ForExcel_Shapes:Working:FILENAME.xlsx"
open theWorkbookFile #open the xls file
set theWorksheetname to name of worksheet 1 of active workbook
set theWorksheet to worksheet 1 of active workbook
tell application "Microsoft Excel" to set display alerts to false
set targetFolder to ("Macintosh HD:Osascript_ForExcel_Shapes:Working:")
save the active workbook as text Mac file format in ((targetFolder as text) & "FILENAME.txt") with overwrite
close the active workbook without saving
end tell
EOD
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT DEBIAN
excel::template::element::cell
Excel::Template::Element::Cell(3pm) User Contributed Perl Documentation Excel::Template::Element::Cell(3pm)NAME
Excel::Template::Element::Cell - Excel::Template::Element::Cell
PURPOSE
To actually write stuff to the worksheet
NODE NAME
CELL
INHERITANCE
ELEMENT
ATTRIBUTES
o TEXT
This is the text to write to the cell. This can either be text or a parameter with a dollar-sign in front of the parameter name.
o COL
Optionally, you can specify which column you want this cell to be in. It can be either a number (zero-based) or an offset. See
Excel::Template for more info on offset-based numbering.
o REF
Adds the current cell to the a list of cells that can be backreferenced. This is useful when the current cell needs to be referenced
by a formula. See BACKREF and RANGE.
o WIDTH
Sets the width of the column the cell is in. The last setting for a given column will win out.
o TYPE
This allows you to specify what write_*() method will be used. The default is to call write() and let Spreadsheet::WriteExcel make the
right call. However, you may wish to override it. Excel::Template will not do any form of validation on what you provide. You are
assumed to know what you're doing.
The legal types (taken from Spreadsheet::WriteExcel) are:
o COMMENT
Add a comment to the cell
o blank
o formula
o number
o string
o url
o date_time
other write_* methods as defined defined Spreadsheet::WriteExcel would be integrated by request
CHILDREN
FORMULA
EFFECTS
This will consume one column in the current row.
DEPENDENCIES
None
USAGE
<cell text="Some Text Here"/>
<cell>Some other text here</cell>
<cell text="$Param2"/>
<cell>Some <var name="Param"> text here</cell>
In the above example, four cells are written out. The first two have text hard-coded. The second two have variables. The third and fourth
items have another thing that should be noted. If you have text where you want a variable in the middle, you have to use the latter form.
Variables within parameters are the entire parameter's value.
Please see Spreadsheet::WriteExcel for what constitutes a legal formula.
AUTHOR
Rob Kinyon (rob.kinyon@gmail.com)
SEE ALSO
ROW, VAR, FORMULA
perl v5.14.2 2012-04-29 Excel::Template::Element::Cell(3pm)