• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: keystroke - cancel modifiers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keystroke - cancel modifiers?


  • Subject: Re: keystroke - cancel modifiers?
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 9 May 2008 14:24:56 +0200


Le 9 mai 2008 à 13:24, Nathaniel Virgo a écrit :

Hi,

I would like my favorite text editor to insert the current time and date when I press command-D. I have inserted the following into its scripts menu:

set date_ to (current date) as string
tell application "System Events" to keystroke date_

which works fine. The problem is that if I assign this the shortcut command-D (using the keyboard preferences pane), then when the script starts running I'm still holding down the command key so that it enters command-F command-R command-I command-D command-A command-Y etc. instead of "Friday...," causing my document to become very strangely formatted.


You may try with:

set the clipboard to (current date) as string
tell application "System Events" to keystroke "v" using {command down}

Yvan KOENIG (from FRANCE vendredi 9 mai 2008 14:24:52) _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: keystroke - cancel modifiers?
      • From: "Nathaniel Virgo" <email@hidden>
References: 
 >keystroke - cancel modifiers? (From: "Nathaniel Virgo" <email@hidden>)

  • Prev by Date: Re: Mail scripting : How to select…
  • Next by Date: Re: Mail scripting : How to select…
  • Previous by thread: keystroke - cancel modifiers?
  • Next by thread: Re: keystroke - cancel modifiers?
  • Index(es):
    • Date
    • Thread