• 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: How can I format an integer ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I format an integer ?


  • Subject: Re: How can I format an integer ?
  • From: Skeeve <email@hidden>
  • Date: Fri, 07 Nov 2008 08:39:28 +0100

André Berg schrieb:
I have also found that you can use normal Python syntax in HERE strings
once you figure out the backslash-salad that is.
You don't need to. Once I also found that for perl but soon learned that ther is a better way and I guess the same is true for python.

In shell you can type:

perl -e 'script here'

I guess in python it's

python -c 'script here'

The solution when you want to do that with AS is:

do shell script "python -c " & (quoted form of "script here")

With this you only have to take care of backslashing quotes and backslashes. I think that's an easy task. At least you don't have to take care for a proper "HERE" - end string, can use linebrakes and indents for formatting purposes and you get the advantage that the python/perl script still can read STDIN for processing (small example with too much code):

do shell script "echo " & myNumber " | perl -e " & (quoted form "
   use strict;
   use warnings;

   while (<>) {
       tr/,./.,/;
      print;
   }
")

_______________________________________________
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: How can I format an integer ?
      • From: André Berg <email@hidden>
References: 
 >Re: How can I format an integer ? (From: Barry Wainwright <email@hidden>)
 >Re: How can I format an integer ? (From: Philip Aker <email@hidden>)
 >Re: How can I format an integer ? (From: Andrea D'Amore <email@hidden>)
 >Re: How can I format an integer ? (From: André Berg <email@hidden>)
 >Re: How can I format an integer ? (From: Philip Aker <email@hidden>)
 >Re: How can I format an integer ? (From: André Berg <email@hidden>)

  • Prev by Date: Re: accessing a property of an object in AppleScript
  • Next by Date: Re: accessing a property of an object in AppleScript
  • Previous by thread: Re: How can I format an integer ?
  • Next by thread: Re: How can I format an integer ?
  • Index(es):
    • Date
    • Thread