• 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: Find all PowerPC Applications in Applications folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find all PowerPC Applications in Applications folder


  • Subject: Re: Find all PowerPC Applications in Applications folder
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 06 Apr 2011 21:10:15 -0400

On Sun, Apr 3, 2011 at 5:32 PM, Christopher Stone
<email@hidden> wrote:
> Given that how would you grab the whole record for each ppc app?  I'd think you could easily find on the whitespace-App-Name-:, discover the ppc kind, and wrap up with the location.

It depends on what you want to do with the whole record once you've
grabbed it.  I mean, it's easy to get an array of hashes in Perl:

#!/usr/bin/perl
local $/ = '';
my @apps = ();
open my $pipe, "system_profiler SPApplicationsDataType|";
my $skip = <$pipe>; # skip "Applications: "
while (<$pipe>) {
  s/^\s*//;
  s/:.*$//ms;
  my $app = { Name => $_ };
  my $data = <$pipe>;
  $app->{$1} = $2 while $data =~ /^\s*([^:]*):\s*(.*)$/gm;
  push @apps, $app;
}

which you can then do Perly things with, like this to duplicate the
output of the previous script:

print join("\n", map { $_->{Location} } grep { $_->{Kind} eq 'PowerPC'
} @apps), "\n";

As a side note, the application name (the one that appears on a line
by itself between two blank lines) is not necessarily unique; you can
have two instances of the same application in different Locations.
That's why I build an array instead of a hash at the top level.

--
Mark J. Reed <email@hidden>
 _______________________________________________
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: Find all PowerPC Applications in Applications folder
      • From: Christopher Stone <email@hidden>
References: 
 >Find all PowerPC Applications in Applications folder (From: Ronald Hofmann <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Christopher Stone <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Ronald Hofmann <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Christopher Stone <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Ronald Hofmann <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Ronald Hofmann <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Christopher Stone <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: "Mark J. Reed" <email@hidden>)
 >Re: Find all PowerPC Applications in Applications folder (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Find all PowerPC Applications in Applications folder
  • Next by Date: Applescript to add user in workgroup manager
  • Previous by thread: Re: Find all PowerPC Applications in Applications folder
  • Next by thread: Re: Find all PowerPC Applications in Applications folder
  • Index(es):
    • Date
    • Thread