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

System Events keystroke altering variable case


  • Subject: System Events keystroke altering variable case
  • From: mbox via AppleScript-Users <email@hidden>
  • Date: Thu, 19 Sep 2019 11:38:39 -0700

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\"'" as string

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

end tell

 _______________________________________________
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: "Jacopille, David via AppleScript-Users" <email@hidden>
  • Prev by Date: Re: General question about InDesign applescript
  • Next by Date: Re: System Events keystroke altering variable case
  • Previous by thread: Re: AppleScript-Users Digest, Vol 16, Issue 95
  • Next by thread: Re: System Events keystroke altering variable case
  • Index(es):
    • Date
    • Thread