• 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: System Events keystroke altering variable case
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Events keystroke altering variable case


  • Subject: Re: System Events keystroke altering variable case
  • From: "Jacopille, David via AppleScript-Users" <email@hidden>
  • Date: Thu, 19 Sep 2019 19:18:31 +0000
  • Thread-topic: System Events keystroke altering variable case

…another way to send this command:


set vers to do shell script ""/usr/local/cpanel/3rdparty/perl/528/bin/perl
-MFile::Next -e 'print $File::Next::VERSION;'"

The \n newline character makes sense if the command is used in Terminal, but
not in AppleScript context.


From: AppleScript-Users
<applescript-users-bounces+djacopille=email@hidden> on behalf of
AppleScript Users <email@hidden>
Reply-To: mbox <email@hidden>
Date: Thursday, September 19, 2019 at 2:39 PM
To: AppleScript Users <email@hidden>
Subject: System Events keystroke altering variable case

Hello,

I'm trying to send a command to Terminal to get the version number of a Perl
module.  The script below works except for one small problem which prevents it
from actually completing.

If I print out _command while debugging, it prints properly:

/usr/local/cpanel/3rdparty/perl/528/bin/perl -MFile::Next -e 'print
$File::Next::VERSION . "\n"'

However, the command that gets passed to Terminal via System Events looks like
this:

/usr/local/cpanel/3rdparty/perl/528/bin/perl -Mfile::Next -e 'print
$File::Next::VERSION . "\n"'

Notice the first occurrence of module_name in that command - the word "file"
gets lowercased, which breaks the command in the cli.  However the strange part
is that the 2nd occurrence of module_name remains properly capitalized.

What is System Events keystroke doing to that command?  Is there another way to
send this command?

Thank you,
Jenni

Mac OS 10.11.6


tell application "Terminal"
activate

set module_name to the text returned of (display dialog "Enter the module name"
default answer "File::Next")

set _command to "/usr/local/cpanel/3rdparty/perl/528/bin/perl -M" & module_name
& " -e 'print $" & module_name & "::VERSION . \"\\n\<smb://n/>"'" as string

tell application "System Events"
keystroke _command
delay 0.1
key code 76
end tell

end tell


MFS Email system made the following annotation
---------------------------------------------------------------------------------------------------------------------------------------
This email communication and any attachments may contain proprietary,
confidential, or privileged information. If you are not the intended recipient,
you are hereby notified that you have received this email in error and that any
review, disclosure, dissemination, distribution or copying of it or its
contents is prohibited. The sender does not waive confidentiality or any
privilege by mistransmission. If you have received this email in error, please
notify the sender immediately, delete this email, and destroy all copies and
any attachments.
 _______________________________________________
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: System Events keystroke altering variable case
      • From: mbox via AppleScript-Users <email@hidden>
References: 
 >System Events keystroke altering variable case (From: mbox via AppleScript-Users <email@hidden>)

  • Prev by Date: System Events keystroke altering variable case
  • Next by Date: Re: System Events keystroke altering variable case
  • Previous by thread: System Events keystroke altering variable case
  • Next by thread: Re: System Events keystroke altering variable case
  • Index(es):
    • Date
    • Thread