• 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: I made a nightmare
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I made a nightmare


  • Subject: Re: I made a nightmare
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 09 Dec 2015 12:37:18 -0600

On Dec 09, 2015, at 12:16, Yvan KOENIG <email@hidden> wrote:
I will probably add the quoteIt handler in all my scripts supposed to build POSIX paths.  I will just change its name to highlight the fact that what is important is not quote but POSIX.
______________________________________________________________________

Hey Yvan,

Gotcha.

One thing I always do when assembling do shell script code is to create the command in text before running it from the text variable.

set shCMD to "echo \"I'm a command\""
do shell script shCMD

With all the quoting and such it can be very hard to read the code, and this method greatly facilitates debugging.

-------------------------------------------------------------------------------------------
set shCMD to "echo \"I'm a command\"!"

# DEBUG
bbeditNewDoc(shCMD, true)
return

do shell script shCMD

-------------------------------------------------------------------------------------------
--ยป HANDLERS
-------------------------------------------------------------------------------------------
on bbeditNewDoc(_text, _activate)
  tell application "BBEdit"
    set newDoc to make new document with properties {text:_text, bounds:{0, 44, 1920, 1200}}
    tell newDoc
      select insertion point before its text
    end tell
    if _activate = true or _activate = 1 or _activate = "activate" then activate
  end tell
end bbeditNewDoc
-------------------------------------------------------------------------------------------

Not only is it easier to eyeball this way, but from BBEdit (or TextWrangler) I can plop in a shebang line and run it to make certain it's working properly.

--
Take Care,
Chris

 _______________________________________________
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: I made a nightmare
      • From: Yvan KOENIG <email@hidden>
References: 
 >I made a nightmare (From: Yvan KOENIG <email@hidden>)
 >Re: I made a nightmare (From: Axel Luttgens <email@hidden>)
 >Re: I made a nightmare (From: Yvan KOENIG <email@hidden>)
 >Re: I made a nightmare (From: Christopher Stone <email@hidden>)
 >Re: I made a nightmare (From: Yvan KOENIG <email@hidden>)
 >Re: I made a nightmare (From: Christopher Stone <email@hidden>)
 >Re: I made a nightmare (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: I made a nightmare
  • Next by Date: Re: I made a nightmare
  • Previous by thread: Re: I made a nightmare
  • Next by thread: Re: I made a nightmare
  • Index(es):
    • Date
    • Thread