Unable to pass data to applescript from data file throughterminal
Deepak Jain wrote:
content of file :
-----------------------------------------------------------------------------
on run argv
set CSV to "& item 1 of argv &"
set afile to open for access CSV
set alllines to read afile using delimiter {return}
close access afile
set a_veriables to {}
repeat with aline in alllines
set oldtids to the text item delimiters
set the text item delimiters to {","}
set list_of_variables to every text item of aline
set the text item delimiters to oldtids
set t1 to item 1 of list_of_variables
set t2 to item 2 of list_of_variables
set t3 to item 3 of list_of_variables
set t4 to item 4 of list_of_variables
--set end of a_veriables to {var1:t1, var2:t2, var3:t3,var:t4}
end repeat
tell application "iCal"
tell calendar "dj"
make new event at end with properties {description:t3, summary:t1,
location:t2, recurrence:t4}
end tell
end tell
end run
-----------------------------------------------------
And csv file which contains 2 rows of data.
|