• 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: Help please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help please


  • Subject: Re: Help please
  • From: "Stockly, Ed" <email@hidden>
  • Date: Fri, 20 Nov 2015 20:45:37 +0000
  • Thread-topic: Help please

This is how I would do it:

—————
set myVariableString to "xyz"— — change as needed
tell application "Safari" — — or whatever app you're sending the
keystrokes to
 activate
 tell application "System Events"
  delay 1
  keystroke "f" using control down
  keystroke ":exec " & myVariableString
  keystroke return
 end tell
end tell
------


The delay is optional (and may cause problems in some OS versions). If the
app  is already frontmost when you run the script you don't need it.

In your script you had a \ before the quotes in your tell application.
That could be causing problems, depending on how you're using the script.








On 11/20/15, 12:34 PM,
"applescript-users-bounces+ed.stockly=email@hidden on
behalf of -"
<applescript-users-bounces+ed.stockly=email@hidden on
behalf of email@hidden> wrote:

>
>I'm new to apple script.  In a previous thhread I was given this to send
>a keystroke combination for control+f:
>
>tell application \"System Events\" to keystroke "f" using control down
>
>This gives the error message:
>
>4:4: syntax error: Expected expression but found end of script. (-2741)
>
>What is the problem?  Perhaps I'm missing something the original poster
>suggested?
>
>Also, as long as I'm here, how would one send this character string
>following  the completion of the "tell" above:
>
>:exec xyz
>
>The "xyz" can vary but the end of the  string must end with a  return.
>
>Thanks for any help.
>
>XB


 _______________________________________________
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


References: 
 >Help please (From: - <email@hidden>)

  • Prev by Date: Re: Design Report for Scripts?
  • Next by Date: Re: Design Report for Scripts?
  • Previous by thread: Help please
  • Next by thread: AppleEvents: Send port for process has no send right, port=( port:37207/0x9157 rcv:1,send:0,d:0 limit:5) (findOrCreate()/AEMachUtils.cp #526)
  • Index(es):
    • Date
    • Thread