Monday, February 27, 2017

#1 2013-01-13 05:51:08 am

ejonesss
Member
Registered: 2008-08-28
Posts: 3

copy result of do shell script

i found the script


set the_month to month of (current date) as integer
set the_year to year of (current date) as integer
set the_cal to (my get_cal(the_month, the_year)) --return my get_cal("", the_year) --leave month empty for full year
set the_days to word -1 of the_cal
return {the_month:the_month, the_year:the_year, the_days:the_days, the_cal:the_cal}

on get_cal(the_month, the_year)
    return (do shell script "cal " & the_month & " " & the_year)
   
end get_cal


witch results in

{the_month:1, the_year:2013, the_days:"31", the_cal:"    January 2013
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
"}

being in the result box and i would like to be able to then get it to the clipboard.




i tried 


set the_month to month of (current date) as integer
set the_year to year of (current date) as integer
set the_cal to (my get_cal(the_month, the_year)) --return my get_cal("", the_year) --leave month empty for full year
set the_days to word -1 of the_cal
return {the_month:the_month, the_year:the_year, the_days:the_days, the_cal:the_cal}

on get_cal(the_month, the_year)
    set temp1 to  (do shell script "cal " & the_month & " " & the_year)
   
end get_cal


tell application "finder"

set clipboard to temp1 as text

end tell

and i get errors or nothing happens.

i am looking for a way to generate calendars with clickable cells that go to web sites.

Offline

 

#2 2013-01-13 05:59:15 am

StefanK
Member
From: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11421
Website

Re: copy result of do shell script

Hi,

the clipboard is one of the rare expressions where the article is required

Applescript:


tell (current date) to set {the_year, the_month} to {year as text, its month as integer as text} -- for the shell script better coerce to text
set the_cal to get_cal(the_month, the_year) --return get_cal("", the_year) --leave month empty for full year
set the clipboard to the_cal
set the_days to word -1 of the_cal
return {the_month:the_month, the_year:the_year, the_days:the_days, the_cal:the_cal}

on get_cal(the_month, the_year)
   set temp1 to (do shell script "cal " & the_month & " " & the_year)
end get_cal

Last edited by StefanK (2013-01-13 06:03:36 am)


regards

Stefan

Offline

 

#3 2013-01-13 07:15:24 am

ejonesss
Member
Registered: 2008-08-28
Posts: 3

Re: copy result of do shell script

thanks..

the thing i am trying to do is make an offline schedule grabber for the discovery channel.

after a phone call to their web admin i think they are doing away with the

http://dsc.discovery.com/tv-schedules/c … ate=201301

it is now drawing a blank calendar

however they are still keeping the http://dsc.discovery.com/tv-schedules/daily.html

and the http://dsc.discovery.com/tv-schedules/d … 130114.014



i found that i can still access the days up to 14 days after current date by changing the 20130114 part.

a big help is i can omit the .014 part so it is just

http://dsc.discovery.com/tv-schedules/d … e=20130114

i want to generate the urls and build my own calendar that has clickable cells to open the pages.

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.046 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)