Inserting date & time in Word 2008 document

I'm trying to create simple AppleScript and I'm hoping someone on here can help me.
I work in Word 2008 for Mac and want to create a script that simply inserts the phrase "Left message(space)" plus the date and time whenever I run the script. I'd also prefer that the phrase be in italics if possible. I use this because I often call people and leave them a message and I like to keep a record of when I call them.
I found this script online and modified it hoping it would meet my needs:
tell application "Microsoft Word"
tell selection
type text text "Left message "
create new field text range text object of selection field text {"DATE \\@ \"MM/d/yyyy\""}
end tell
end tell
The result is that when I run the script, I get something like this in my document:
Left message 6/10/2010
It's a good start, but there are two problems with this.
First, I would like to insert both the date AND the time.
Second, when it inserts the date, it makes it an "update automatically" date that updates to the current time every time I open the document. This obviously doesn't help me keep a record of when I made a call. What I would like is for it to just insert the current date and time without updating automatically.
Third, if possible, I would also like it to be in italics.
It would look something like this:
+Left message 6/10/10 5:29 PM+
I appreciate any advice people can give.
Message was edited by: LJH_CMH

Second, when it inserts the date, it makes it an "update automatically" date that updates to the current time every time I open the document
Sure, that's because you specifically tell it to. Your script inserts a 'new field' which is analogous to Word's dynamic text objects (date, time, page number, etc.)
Instead, what you want to do is insert an actual string of characters - sure, to you and I that string of characters might look like a date and time, but to Word it's nothing more than a series of characters.
For that we can fall back on AppleScript's date features, specifically current date, like:
tell application "Microsoft Word"
  tell selection
    type text text "Left message " & (current date as text)
  end tell
end tell
Note that current date as text returns a rather verbose form of the date. If that's too much for you there are alternate options, such as:
short date string of (current date) & space & time string of (current date)
which will look more like: "6/10/10 3:26:50 PM"
But there is also a myriad of other ways (with seconds, without seconds, 12/24 hr, etc.) depending on what you want.
Third, if possible, I would also like it to be in italics.
I'll have to look at that one, unless someone else beats me to it.

Similar Messages

  • FUNCTION MODULE TO CONVERT DATE / TIME INTO WORDS.

    HI EXPERTS,
         FUNCTION MODULE TO CONVERT DATE / TIME INTO WORDS.
    PLS DO HELP.....

    Hiii gita
    we have another FM SPELL_AMOUNT
    regards
    Jaipal

  • Inserting Date & Time in picture

    Hi,
    I am new to Adobe, after strugling to get iMovie to produce a decent HD movie, I am delighted with Premiere Elements 9 so far.  I am, however, asking for help and assistance in trying to insert the date & time (that the footage was shot) into text on the screen.  iMovie had this function which was very useful for home movies, but I cannot find this option?  Also, I have run a test video and have found a sound/video sync problem.  I am not running anti-virus software as I have a MAC and the saved movie is being exported to an external HDD through firewire.  Any help would be very much appreciated!
    Thanks
    John

    John,
    Welcome to the forum.
    PrE does not have a direct way to do this, however, you can create a Title, and manually add the time/date as text.
    There is a program, DVDate, that might prove to be helpful, though it's not a plug-in for PrE, so there is still some additonal work in the normal workflow.
    Good luck,
    Hunt

  • Insert date time into oracle database from jsp

    pls tell me ,from jsp how can I insert datetime values into oracle database .I am using oracle 9i .here is codethat i have tried
    html--code
    <select name="date">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="month">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="year">
    <option selected>dd</option>
    <option>2004</option>
    <option>2005</option>
    <option>2006</option>
    <option>2007</option>
    </select>
    here the jsp code
    <% date= request.getParameter("date"); %>
    <% month= request.getParameter("month"); %>
    <% year= request.getParameter("year"); %>
    try
    { Class.forName("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException exception)
    try
         Connection connection = null;
         out.println("connectiong the database");
    connection = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcsid","scott","tiger");
    out.println("connection getted");
         int rows = 0;
         String query_2 = "insert into mrdetails values(?)";
         String dob = date+month+year;
         prepstat = connection.prepareStatement(query_2);
         prepstat.setTimestamp(4,dob);
         rows = prepstat.executeUpdate();
         out.println("data updated");
    catch (Exception exception3)
    out.println("Exception raised"+exception3.toString());
    }

    To insert date values into a database, you should use java.sql.Date. If it also has a time component, then java.sql.TimeStamp.
    Your use of prepared statements is good.
    You just need to convert the parameters into a date.
    One way to do this is using java.text.SimpleDateFormat.
    int rows = 0;
    String query_2 = "insert into mrdetails values(?)";
    String dob = date+"/" + month+ "/" + year;
    SimpleDateFormat sdf = new SImpleDateFormat("dd/MM/yyyy");
    java.util.Date javaDate = sdf.parse(dob);
    java.sql.Date sqlDate = new java.sql.Date(javaDate .getTime);
    prepstat = connection.prepareStatement(query_2);
    prepstat.setTimestamp(4,sqlDate);
    rows = prepstat.executeUpdate();
    out.println("data updated");Cheers,
    evnafets

  • Insert Date & Time question

    Does anyone know if there is a way to DESELECT the "Automatically update the date and time when the document is opened" dialog?
    Thanks.
    Paul

    The only way I can see is to create your own template with this unchecked. Then, when you open this template, auto date & time should be unchecked.
    It would be nice if this were a global preference. I suggest you leave feedback for the Pages team.

  • Inserting DATE/TIME

    hi
    I am using
    INSERT INTO LIB_BOOK_ISSUE (ISSUE_DATE, AC_NO) SELECT ISSUE_DATE, AC_NO FROM LIB_BOOK_ISSUE5
    to move data from LIB_BOOK_ISSUE5 to LIB_BOOK_ISSUE.
    ISSUE_DATE has Date/Time valuse. When I use above INSERT statement then just Dates are inserted into LIB_BOOK_ISSUE. Plz write me the query so that both Date/Time values move.
    Thanks

    column ISSUE_DATE and AC_NO both play as primary key.
    if i use
    insert into LIB_BOOK_ISSUE select * from LIB_BOOK_ISSUE5;
    then there is an error that unique value violated. thats why i think that if time value is not copying to LIB_BOOK_ISSUE5 then there may be unique key violation, elese there is no way that there is any key violation

  • How to insert date/time to sql database

    Hi,
    I would like to insert date and time alongside with my data receiving from the sensor.
    Right now i can insert data into sql table everytime when the data changes but i also wanted to insert the date and time as well.
    Thank you in advance!

    I create a field that is a datetime and set the default value to getdate().  So everytime i make an entry into this database, it automatically adds a datestamp.

  • Insert data in UDT of type Document/Document_line

    hi all
    i am in great need to insert data in a UDT of type Document/Document_line through code. i have created a UDO of my tables and now want to insert data in these tables through code.
    how to achieve this, plz do reply me as soon as possible
    thanks.

    Dim userTable As SAPbobsCOM.UserTable
            'Use the user table we added before
            userTable = oCompany.UserTables.Item("YourTableName")
            'Add a first row in the table
            userTable.Code = "A1"
            userTable.Name = "A.1"
            userTable.UserFields.Fields.Item("U_Your1stField").Value = "First value"
    userTable.UserFields.Fields.Item("U_Your2ndField").Value = "2nd Value"
            userTable.Add()
            'Second row in the @TB1300 table
            userTable.Code = "A2"
            userTable.Name = "A.2"
            userTable.UserFields.Fields.Item("U_Your1stField").Value = "Second value"
            userTable.Add()
    userTable.UserFields.Fields.Item("U_Your2ndField").Value = "Row 2 UDF 2"
            userTable = Nothing

  • Insert data from SQL Server 2008 St.Ed to ORACLE 11gr2 St. Edition

    Dear all,
    I'm searching a solution for faster transmission of data of a db SQL Server (2008 St. edition) vs PROD db that is an ORACLE 11gr2 St. edition too.
    Actually this operation spend 1,5 hours but I'd like cut this time because size of the data grow up in future and this time could be a serious problem ....
    Looking on Oracle Enterprise Manager I've seen that main problem is about commit .. SQL Server every record insert into Oracle TBL generate a commit  ... unfortunately I cannot insert when commit must be done ... If will be solved it probably may be solved situation ...
    Thanks in advance for every idea.
    Andrea

    Nardo wrote:
    SQL server is connect with Oracle DB by OLEDB, commit every record is why SQL haven't possibility of manage it ... anyway I'm sorry for delay of the answer, I've solved using sqlloader ... faster and without impact ... must be have hight attention if there will be change any field ... that's all.
    REDO upgrade was done like first step because anyway it was too small.
    Thanks for you answer and sorry again for delay !!!!
    Thanks.
    If you are depending on MS SQL server technology to do this, you are going to be stuck with the performance of that technology.
    A few weeks ago we had a need to load institute a daily load of or DW from a MSSQL database.  The MS-centric person responsible developed a procedure (using MS tools) that took 4.5 hours to load 1.2 million rows.  I ran a session trace and the tkprof report revealed exactly what has already been described.  Single row insert and commit.  I knocked together a PL/SQL procedure that did a single INSERT .. (SELECT .. FROM TABLE@MSSQL). and it ran in 4 minutes.  Using the Oracle transparent gateway for ODBC.

  • Word 2008 document display window problem

    I have a macbook air, and having trouble with my 2008 word program. when I open a document (or new document) it will only open in a small window and will not allow me to make it larger. it just started doing this randomly.

    2008 is now a long time ago in terms of technology.  There have been two major releases of Microsoft Word for Mac since then: Microsoft Office for Mac 2011 and Microsoft Office 365.
    I don't know for sure whether Office for Mac 2008 runs on Mavericks, but I suspect this may be your issue.

  • Problem while inserting Date/Time in Oracle Database

    Hai,
    i want to insert the date and time in a date column. here, i am using java.sql.Date and java.sql.Time to assign the date in Prepared Statement.
    PreparedStatement psmt=con.prepareStatement("insert into test(ex_date) values(?)");
    java.util.Calendar c=Calendar.getInstance();
    c.set(2002,2,21,10,10,00);
    java.sql.Date d=new Date(c.getTime().getTime());
    java.sql.Time t=new Time(c.getTime().getTime());
    psmt.clearParameters();
    psmt.setDate(1,d);
    psmt.setDate(1,t);
    psmt.executeUpdate();
    Above program is inserted the Date and time in the database as the following "1900/2/21 10:10 AM"
    but i am giving the year as 2002. it inserted the year as 1900. what is the problem with the code?
    please let me know
    Thanks in advance.
    Regards
    sankarjune14

    Hai Franco,
    i put the wrong code. Here, is the Original Code.
    PreparedStatement psmt=con.prepareStatement("insert into test(ex_date) values(?)");
    java.util.Calendar c=Calendar.getInstance();
    c.set(2002,2,21,10,10,00);
    java.sql.Date d=new Date(c.getTime().getTime());
    java.sql.Time t=new Time(c.getTime().getTime());
    psmt.clearParameters();
    psmt.setDate(1,d);
    psmt.setTime(1,t); // Last time i put psmt.setDate(1,t);
    psmt.executeUpdate();
    and, the getTimeInMillis() method is a protected method in java.util.Calendar class. how can we use it
    please give me some other idea to insert the date and time in oracle database.
    Thanks in advance
    sankarjune14

  • Font problem after inserting date/time.

    Can anyone help me with this problem? I write a daily journal in Times New Roman, 18 pt. However, when I have it insert the date and time it inserts it fine as TNR 18. But if I type the very next character it is TNR 10 pt. How do I prevent this?
    Thanks.
    Paul

    Paul, did you by chance change the Body text Paragraph Style to TNR 18? Or is it still set to 10?
    If it is set to 10 then while the Date and Time are going to be 18, Pages is reverting back to the normal Body paragraph Style, which is probably 10.
    You can get around this by changing your body style, or making a new one called "Entries" which is set to 18.

  • Insert Date Time

    db = XE
    I have imported the exif data from some images into an oracle table. I now want to insert the data into some other tables.
    I am having difficulty with the date and time data.
    The exif export contains the date and time like this;
    2011:11:30 18:19:56
    I have attempted to insert the data using the following sql;
    INSERT ALL
      INTO exif VALUES (exif)
    SELECT to_date(createdate,'YYYY/MM/DD HH24:MI:SS')
      FROM metadata;But it returns the following error;
    Error starting at line 13 in command:
    INSERT ALL
      INTO exif VALUES (exif)
    SELECT to_date(createdate,'YYYY/MM/DD HH24:MI:SS')
      FROM metadata
    Error at Command Line:14 Column:20
    Error report:
    SQL Error: ORA-00904: "EXIF": invalid identifier
    00904. 00000 -  "%s: invalid identifier"
    *Cause:   
    *Action:I created a table like this;
    CREATE TABLE exif
        exif DATE
      );Could someone tell me what the problem is?
    Cheers
    Ben
    Edited by: benton on Dec 7, 2011 3:31 PM
    Edited by: benton on Dec 7, 2011 3:32 PM

      1  CREATE TABLE exif1
      2    (
      3      exif DATE
      4*   )
    SQL>
    SQL> /
    Table created.
    SQL> INSERT ALL
      INTO exif1(exif)
    SELECT to_date(SYSDATE,'YYYY/MM/DD HH24:MI:SS')
      FROM dual
    SQL> /
    1 row created.
    SQL> INSERT ALL
      INTO exif1(exif)
    SELECT to_date(SYSDATE+level,'YYYY/MM/DD HH24:MI:SS')
      FROM dual
    connect by level <=10
    10 rows created.

  • Print PDF document with printer's name and date/time of print

    Hi,
    I'm pretty new to this...
    I have a PDF document and when I print it, I want the printer's name and the date/time of print to be showed on the printer's output.
    I have several printers (some local and some on network) and don't necessarly use the default one. I would like the name of the printer used, to be printed on the document.
    With var h = this.getField("Printer"); h.value = app.printerNames; I'm able to get the list of all printers available but I just need the one used.
    For the date/time, using var f = this.getField("Today"); f.value = util.printd("mmm/d/yyyy", new Date()); gives me the date/time of when the document is open, not when the document is printed. (or maybe I'm missing something?)
    I guess the date/time issue is not the major one as there is usually not much difference between the time you open the document and the time you print it.
    I'm more interested in the printer's name.
    I use Acrobat Pro 9 to edit my PDF document.
    Can anyone help me please?
    Thanks!

    This project was left aside for a while... but it's now finished!
    Thank you for the answers. It was helpful.
    Here is a step-by-step of what I did (using Adobe Acrobat 9.5.1):
    Open PDF document in Acrobat
    Select Forms -> Add or Edit Fields
    Add two text fields: one called "Today" for the date and one called "Printer" for the printer name
    Close the form editing
    Select Advanced -> Document Processing -> Set Document Actions...
    Then select Document Will Print and Edit
    Paste the following code:
    var f = this.getField("Today"); f.value = util.printd("dd mmm yyyy - HH:MM", new Date());
    var pp = this.getPrintParams();
    this.getField("Printer").value = pp.printerName;
    Save your PDF
    Enjoy!
    The date and printer name field will be automatically updated when you print the document!

  • How to identify date & time of insertion of rows in a table

    Hi,
    Is it possible to identify the date & time of insertion of rows in a table?
    for example:
    Table name: emp
    I have rows like this
    emp_code name dept
    pr01 ram edp
    ac05 gowri civil
    pr02 sam pro
    i want to know the date and time of the insertion this( ac05 gowri civil).
    Could you please help me.....
    Thanks in advance....

    psram wrote:
    sorry for the confusion. I dont want to store date and time. I said that for example only.
    I have table which consists of thousands of rows. I want to know the insertion date & time of a particular row.
    Is it possible?So, if I have a table that stores a load of employee numbers, do you think I could get the database to tell me their names?
    If you don't store the information, you can't query the information.
    Ok, there are some dribbs and drabbs of information available from the back end of the database via the SCN's, Archive Logs etc., but those sort of things disappear or get overwritten as time goes by. The only way to know the information it to ensure you store it in the first place.
    So, in answer to your question, No, there isn't a true and reliable way to get the data/time that rows were inserted into the table, unless you have chosen to store it alongside the data.

Maybe you are looking for