• 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
Basic applescript and command line scripting issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Basic applescript and command line scripting issues


  • Subject: Basic applescript and command line scripting issues
  • From: Scott Haneda <email@hidden>
  • Date: Tue, 15 Mar 2005 21:18:02 -0800

Title: Basic applescript and command line scripting issues
I am relatively new to AppleScript, I have pretty strong experience in other languages, so please bare with me.

I have been trying to write some shell scripts that will allow me to talk to my email server, EIMS, it has a AS dictionary.

For example, here is a script that ran fine on OS 9, now on OS X, it will not run and errors on the "write" command

set fileName to choose file name with prompt "Save log file as:" default name "password audit.txt"
set logFile to open for access fileName with write permission
tell application "EIMS Server X"
    set theDomains to GetDomains
    repeat with aDomain in theDomains
        set theUsers to GetUsers aDomain
        repeat with aUser in theUsers
            set theUser to GetUser {domain:aDomain, username:aUser}
            if class of theUser is integer then
                write "Error of type " & theUser & " for " & aUser & "@" & aDomain & return to logFile
            else
                set thePassword to password of theUser
                
                write aUser & "@" & aDomain & tab & thePassword & tab & return to logFile
                
            end if
        end repeat
    end repeat
end tell
close access logFile

Is there some new way I need to tell OS X to write a file out, it seems to be getting stuck?  As a test, I tried to move this to a simple shell script since I know I can "echo" the results to a file, which also did not work, and brought up some more questions:

I find I need to wrap my schell scripts in
exec osascript <<EOF
... some AS code ...
EOF

Is this the preferred way to get inot applescript mode?

How within the script can I send debugging info back out the the terminal, for example, I might use print "we are at line 25"; in some code, I can not seem to get AppleScript to do anything like that.

thanks
--
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Basic applescript and command line scripting issues
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: AppleScript feature request - encryption
  • Next by Date: Re: Address Book Scripts
  • Previous by thread: Re: Applescript-users Digest, Vol 2, Issue 177
  • Next by thread: Re: Basic applescript and command line scripting issues
  • Index(es):
    • Date
    • Thread