Converting the date to make iCal appointment

Hey Gang,
Im working on a script to mac iCal appointments that have an email alarm to send out a templated email.
I am unable to figure out what im missing to get the date to be recognized.
The goal of the entire script is:
popup - ask for the date of the appointment
popup - ask for the eMails of the persons involved
and then make an ical alarm to send an email out, the day before the actual appointment.
i feel there is a way better way for me to be working with the date in this situation but cant sort out what way.
any help would be grateful
on run
          set y to (year of (current date) as string)
          set m to (month of (current date) as string)
          set m2 to month of ((current date) + 30 * days) as string
##get day of month
          set theDay to (choose from list {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} ¬
                    with prompt "Select the Day of the appointment") as text
          set theMonth to (month of (current date) as integer)
##Get the email list
          set emailList to ""
          set emailList to text returned of (display dialog "List the eMails of Presentation participants" default answer "[email protected], [email protected]")
##Make the ical event
          tell application "iCal"
                    tell calendar "Home"
                              set theDate to (theDay & "/" & theMonth & "/" & y) as string
  date theDate
                              make new event at end with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:theDate, allday event:true}
                              set now to theDate
                              set eventStart to theDate
                              set eventEnd to theDate + 2 * minutes
                              set eventName to ("Presentation for " & emailList) as string
                              set alarmTime to (now - 1 * days) as string
                              tell application "iCal"
                                        set newEvent to make new event of calendar "Home" with properties {summary:eventName, start date:eventStart, end date:eventEnd}
                                        set theAlarm to make new mail alarm at end of mail alarms of newEvent with properties {trigger interval:alarmTime}
                              end tell
                    end tell
          end tell
end run

so the user interaction has changed. your scripts will help me in the future though. Thanks
I re-wrote the start but for whatever reason it wont make the iCal event with alarm.
it says unable to get date of Calendar 'Home'
and using the code
(date theDate) work with the other script. i only used that as it was in a textbook.
##Get the Date
set theDate to text returned of (display dialog ¬
          "Enter the Date" with title ¬
          "Presentation Reminder" with icon 1 ¬
default answer ¬
          "d/m/year" buttons {"Cancel Apt", "Make Apt"} ¬
default button 2)
set now to (date theDate)
##Get the email list
set emailList to ""
set emailList to text returned of (display dialog "List the eMail's of Presentation participants" default answer "[email protected], [email protected]")
##Make the ical event
tell application "iCal"
          tell calendar "Home"
  --date theDate
                    make new event with properties {description:"Event Description", summary:"Event Name", location:"Event Location", start date:(date theDate), allday event:true}
                    set eventStart to (date theDate)
                    set eventEnd to ((date theDate) + 2 * minutes)
                    set eventName to ("Presentation for " & emailList) as string
                    set alarmTime to (now - 1 * days) as string
                    set newEvent to make new event of calendar "Home" with properties {summary:eventName, start date:eventStart, end date:eventEnd}
                    set theAlarm to make new mail alarm at end of mail alarms of newEvent with properties {trigger interval:alarmTime}
          end tell
end tell
end run

Similar Messages

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

  • Which  Function Module is used for converting the DATE in BDC

    HI,
    Which  Function Module is used for converting the DATE Format in BDC for Uploading purpose please help me.

    data : date like sy-datum.
    data : odate(10) type c.
    date = sy-datum.        " in format YYYYMMDD
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
      EXPORTING
       input         = date
    IMPORTING
       OUTPUT        = odate         .
    write:/ odate.  "in ur format '.
    1.
    In ur itab make a field for date as 10 characters and use this Fm to store the date .
    2. Pass the date as the charcter field to the screen and now check .

  • How can i convert the date from M to MM ?

    Dear Guru ,
    I need to upload my list to SAP table , and in the list , we are using YYYY/M/D format ( Eg. 2010/5/20 , 2010/10/1 ) .
    And now i want to convert all date format to YYYY/MM/DD , Is it possibile to do that ?
    Here is my code , but it doesn't work . It returned "2009//3//5" format .
    data: ld_date_int type datum.
    data : test(10) type c.
    test = '2009/3/5' .
    ld_date_int = test .
    WRITE : SY-SUBRC , LD_DATE_int .
    Does SAP provide a standard function can convert the date format ?
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Dear
    You can try in this way :::
    data: ld_date_int type string.
    DATA : ld_string TYPE string.
    data : test(10) type c,
           ld_res1(4) TYPE c,
           ld_res2(2) TYPE c,
           ld_res3(2) TYPE c.
    DATA : ll_res2 TYPE i,
           ll_res3 TYPE i.
    test = '2009/03/5' .
    ld_date_int = test .
    ld_string = strlen( ld_date_int ).
    CASE ld_string.
      WHEN 10.
       WRITE : SY-SUBRC , LD_DATE_int.
      WHEN OTHERS.
        SPLIT ld_date_int at '/' INTO ld_res1 ld_res2 ld_res3 in CHARACTER MODE.
        ll_res2 = strlen( ld_res2 ).
        ll_res3 = strlen( ld_res3 ).
        IF NOT ll_res2 eq 2 and not ll_res3 eq 2.
          CONCATENATE: '0' ld_res2 INTO ld_res2.
          CONCATENATE: '0' ld_res3 INTO ld_res3.
          CONCATENATE ld_res1 '/' ld_res2 '/' ld_res3 INTO ld_date_int.
          WRITE : SY-SUBRC , LD_DATE_int.
        ENDIF.
        IF ll_res2 eq 2 and not ll_res3 eq 2.
          CONCATENATE '0' ld_res3 INTO ld_res3.
          CONCATENATE ld_res1 '/' ld_res2 '/' ld_res3 INTO ld_date_int.
          WRITE : SY-SUBRC , LD_DATE_int.
        ENDIF.
        IF NOT ll_res2 eq 2 and ll_res3 eq 2.
           CONCATENATE: '0' ld_res2 INTO ld_res2.
            CONCATENATE ld_res1 '/' ld_res2 '/' ld_res3 INTO ld_date_int.
             WRITE : SY-SUBRC , LD_DATE_int.
        ENDIF.
    ENDCASE.

  • How to convert the date time from MM-DD-YYYThh:mm:ss to YYYY-MM-DDThh:mm:ss format

    Hi All,
    I have a requirement in my project like to convert the date time from one format to another.my situation is like to convert the date time from MM-DD-YYYThh:mm:ss to YYYY-MM-DDThh:mm:ss format. I am using the soa suite 11.1.1.6.
    Can any one suggest me how to convert in the BPEL transformation.
    Thanks,
    Sanju.

    Hi Sanju,
    Store the date to be converted into a variable viz. dateVar. Now, process an expression in assign as: xp20:format-dateTime($dateVar,'[Y0001]-[M01]-[D01] [h]:[m01]:[s01]').
    Regards

  • ABAP code in update rules to convert the date

    Hi,
    Could any one send me the ABAP code that is written in the update rules to convert the date (DD/MM/YYYY  -- lenght 10) to YYYYMMDD ---  length 8  format.
    Also please let me know where I should write this code; while creating update rules or while creating infosource.
    Thanks,

    Hi Bharath,
    Hi Bharath,
    I suggest you do the conversion of dates in the transfer rules. Here is the correct code you need:
    * Assuming the source data field is called MYDATE
    * Place the ff. in the routine in the transfer rules:
    concatenate tran_structure-mydate+6(4) tran_structure-mydate+3(2) tran_structure-mydate(2) into result.
    replace MYDATE with the name of the source field (10 chars) in the transfer structure. Hope this helps.

  • How to convert the data decoded by MJPEG Decoder MFT into RGB32

    I try to play .avi file(Motion JPEG) with MJPEG Decoder MFT and
    My ColorConverter MFT to convert into RGB32 by using the Media Foundation.
    The output format of MJPEG Decoder MFT is YUY2.
    So, I implemented My ColorConverter MFT to convert YUY2 into RGB32.
    I set the  topology to play .avi file and  to convert into RGB32.
    But I got a MEError event with ME_ARITHMETIC_OVERFLOW in
    IMFMediaEvent->GetStatus(&hrStatus)); after the event MESessionTopologyStatus.
    So,the file isn't started to play.
    The created topology is follow.
      Source-> MJPEG Decoder MFT -> My ColorConverter MFT -> EVR
               Format:                    YUY2                                         
    RGB32
    Why do the error occur in processing to convert the data decoded by MJPEG Decoder MFT
    into RGB32?
    Please tell me a appropriate way to convert the data decoded by MJPEG Decoder MFT
    into RGB32.

    You've got the High Speed Data Reader.vi as a starting point. That will retrieve the binary data and plot it on a chart. From the array of sgl's created, you could then use the Write to Spreadsheet File.vi to create a comma or tab separated file. The other option is to write the data straight to Excel using ActiveX. There's a shipping example that shows how that's done as well.

  • Is there any function module to convert the date format

    Dear ABAPers,
    Is there any function module to convert the date format from dd.mm.yyyy to dd-mmm-yyyy.
           I want to convert the date format from dd.mm.yyy to dd.mmm.yyy Eg.from 10.03.2008 to 10-mar-2009.
    Thanks & Regards,
    Ashok.

    hi,
    create custom function module or copy the below code in the report ..and use it
    the out put for below is :----Convert a DATE field into a full format date eg. March 23, 2000
    FUNCTION Z_CONVERT_DATE_INTO_FULL_DATE.
    ""Local interface:
    *"       IMPORTING
    *"             VALUE(DATE) LIKE  SY-DATUM
    *"       EXPORTING
    *"             VALUE(FORMATTED_DATE)
    *"       EXCEPTIONS
    *"              INVALID_DATE
    TABLES: TTDTG.
    DATA: BEGIN OF T_DATE,
            YYYY(4) TYPE C,
            MM(2) TYPE C,
            DD(2) TYPE C,
          END OF T_DATE.
    DATA: DAY(3) TYPE N.
    DATA: VARNAME LIKE TTDTG-VARNAME.
    IF DATE IS INITIAL.
      CLEAR FORMATTED_DATE.
      EXIT.
    ENDIF.
    check document date format
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        DATE = DATE
      EXCEPTIONS
        PLAUSIBILITY_CHECK_FAILED = 1.
    IF SY-SUBRC NE 0.
      RAISE INVALID_DATE.
    ENDIF.
    MOVE DATE TO T_DATE.
    CONCATENATE '%%SAPSCRIPT_MMM_' T_DATE-MM INTO VARNAME.
    SELECT SINGLE * FROM TTDTG WHERE SPRAS = 'EN' AND VARNAME = VARNAME.
    WRITE T_DATE-DD TO DAY.
    CONCATENATE DAY ',' INTO DAY.
    CONCATENATE TTDTG-VARVALUE DAY T_DATE-YYYY INTO FORMATTED_DATE
      SEPARATED BY SPACE.
    ENDFUNCTION.
    the output is :--Convert a DATE field into a full format date eg. March 23, 2000
    Regards,
    Prabhudas

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • Routine to convert the date into month/year

    Hi friends,
    I have requirement like I have 0billdate, but i want only month and year in that.  So i have created a z object  for that taking reference as 0calmonth.  I think the format is yyyymm.
    So now I want to write a routine which converts the date to month/year.  If anybody know this please let me know.
    Regards
    San Reddy

    Hi
    in the trnasfer rule or in the update rule select the Zinfo object to which you need to do conversion
    in details select formula and create.
    Select all functions and follow the steps below.
    use the conversion function DATE_MONTH( )
    Short Text
    Function: Date -> Month
    Functionality
    Calculates the month from a specified date.
    Requirements
    The date must appear in the format yyyymmdd.
    Parameters
    DATE_MONTH (date)
    Result
    The result is calculated in the format yyyymm.
    Regards
    RaM

  • FM to convert the date in to the format in SU01

    hi,
    will u pls suggest the FM to convert the date in the format presented in SU01->Defaults.
    with respect to user the diffrent format may stored in the su01.
    kindly suggest.
    thanks.

    data: dat TYPE date,
           org TYPE date.
    This function module converts data from the sy-datum format to ddmmyyyy.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
      EXPORTING
        input         = sy-datum
    IMPORTING
       OUTPUT        = dat.
    write: sy-datum.
    write: dat.
    This function module converts data to sy-datum format.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_INPUT'
      EXPORTING
        input         = dat
    IMPORTING
       OUTPUT        = org
    write: org.
    You can change the user settings for date using the transaction SU01.

  • Convert the date

    Hi Experts,
            Is there any FM to Convert the date from 04/01/2009 to 4/1/2009?
    i want to remove the zero before the date and month.
    Regards.

    Hi,
    Test the following Sample Code it will solve out your problem,
    PARAMETERS: date like sy-datum.
    data: day(2),
          month(2),
          year(4),
          cdate(10).
    day = date+6(2).
    month = date+4(2).
    year = date+0(4).
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        input         = day
    IMPORTING
       OUTPUT        = day
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        input         = month
    IMPORTING
       OUTPUT        = month
    CONCATENATE: day '/' month '/' year into cdate.
    WRITE: cdate.
    Best Regards,
    Faisal

  • Convert the date into user default date formate

    I am wrinting a bdc and i want to convert the date into user default date farmate ..please suggust the functiom module should i use...

    actually by using dats or d type you can get the user specific date itself.
    but if u have different dates format that need to be converted to the user specific date then you can follow below procedure
    1. retrieve the user format from usr01
        SELECT SINGLE datfm
          INTO w_datfm
          FROM usr01
         WHERE bname EQ sy-uname.
    pass w_datfm to the below FM (4th import parameter)
    2. create Z - FM and retrieve the user secific date
    FUNCTION ZFXX_USER_SPECIFIC_DATE.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IW_DAY) TYPE  CHAR2
    *"     VALUE(IW_MONTH) TYPE  CHAR2
    *"     VALUE(IW_YEAR) TYPE  CHAR4
    *"     VALUE(IW_DATFM) TYPE  USR01-DATFM
    *"  EXPORTING
    *"     VALUE(EW_USER_DATE) TYPE  CHAR0008
    *1  DD.MM.YYYY
    *2  MM/DD/YYYY
    *3  MM-DD-YYYY
    *4  YYYY.MM.DD
    *5  YYYY/MM/DD
    *6  YYYY-MM-DD
    CASE iw_datfm.
      when '1'.
        concatenate iw_day iw_month iw_year
               into ew_user_date.
      when '2'.
        concatenate iw_month iw_day iw_year
               into ew_user_date.
      when '3'.
        concatenate iw_month iw_day iw_year
               into ew_user_date.
      when '4'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when '5'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when '6'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when others.
        clear ew_user_date.
    endcase.
    ENDFUNCTION.

  • Could not convert the data value due to reasons other than sign mismatch or overflow. ADSI Provider

    I'm trying to run the following query against Active Directory using the ADSI Provider using SSMS 2012 SP1:
    SELECT
    TOP901
    *FROMOpenQuery
      ADSI
    'SELECT description
      FROM  ''LDAP://OU=MMICorporate,DC=mmis,DC=mi,DC=com''
      WHERE objectClass =  ''User''
    and objectcategory = ''Person''
    and ''userAccountControl:1.2.840.113556.1.4.803:''<>2
    )AStblADSI
    Msg 7346, Level 16, State 2, Line 2
    Cannot get the data of the row from the OLE DB provider "ADsDSOObject" for linked server "ADSI". Could not convert the data value due to reasons other than sign mismatch or overflow.
    I only have this issue querying the Description Field. 
    I also found a hotfix KB: 887474 for this but it is for Windows 2003.  SQL Server OS I have is Server 2008 R2.  Is there a fix for 2008 R2?
    Thanks

    Thanks for the quick response.
    I checked out the link and I can only convert to Ul8 and when I try I get the same error:
    SELECT
    TOP901
    *FROMOpenQuery
      ADSI
    'SELECT name, convert(UI8, description)
      FROM  ''LDAP://OU=MMICorporate,DC=mmis,DC=mi,DC=com''
      WHERE objectClass =  ''User''
    and objectcategory = ''Person''
    and ''userAccountControl:1.2.840.113556.1.4.803:''<>2
    )AStblADSI
    Am I missing something?
    Thanks

  • Encrypt the data and make the model unusable

    hi, having to distribute the 3d animations made ​​with sap, I would like to be sure that the data contained in the CAD models exported (. rh. vds pdf 3d) can not be used to reconstruct the model. How can I encrypt the data and make the model unusable?
    thanks

    Max,
    There are other forms of file-based protection offered for mobile devices (SAP Afaria) and by other software vendors to secure the end deliverable (e.g. Adobe for 3D PDFs).   In addition, SAP's partner NextLabs offers a very comprehensive solution to automate the security of your sensitive information and even provide expiration dating.
    In addition to file protection, 3D Visual Enterprise includes a function to obfuscate the geometry itself thereby making reverse engineering almost impossible.   The "Randomize Objects" function can be used to randomly skew the vertices of the model by small amounts.  It keeps the normals correct, however, so that the object still looks smooth. This in turn makes precise measurements extremely difficult.
    Regards,
    Ken

Maybe you are looking for

  • Share iTunes Library between Leopard & Tiger?

    I have 2 internal HDs in my Quad G5. One boots Tiger, the other boots Leopard. Because of its very large size, I moved my iTunes music (and videos) from Tiger to an external HD, following the standard procedure for moving ones library. All works fine

  • Green/Purple video during HD import

    While importing HD video from both Sony and Canon HD videocameras via Firewire 800, the video plays in green and purple. During review of the imported video, the screen shows normal colors with flickering intermittent green and purple. Any ideas? Bot

  • How to use activeX viewer with java( CR XI)

    Post Author: jws1624 CA Forum: JAVA Hi I could find any sample source or refference about usging activeX viewer and java (CR XI R2 sp3). Because of downloading excel(export function), I can't choose JRC viewer . So I think activeX viewer is only way

  • Can't edit greyed-out HTML [was: hi]

    can anyone help us out we editing html file on dreamweaver, but some file can not be edited due to be grey or locked ... not to unlock it please help really appreciated [Subject line amended by moderator for clarity]

  • NI 9401 pulse width measurement.

    Hello, I'm not sure I fully understand the pin-out diagram. At present I have a NI9401 in a NI 9172 chassis.  DIO0 and DIO1 are connected to light gates. I have an opto switch and I want to measure the pulse width when an object blocks passes through