• 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: If Statements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: If Statements


  • Subject: Re: If Statements
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 11 Sep 2008 09:19:36 -0400

Assuming you're using Script Editor...

The "Compile" menu option just gets the script ready to run, without
actually running it - good for a quick syntax check if you want to
make sure you didn't make any typos but aren't ready to have it
actually execute yet.  It doesn't write anything usable out to disk,
though.  What you want is "Save As... Application".

On Thu, Sep 11, 2008 at 9:14 AM, William J Sisti <email@hidden> wrote:
> Alright, dumb question. How do I compile it to distribute the script to
> users as a simple double click and run application?  Hitting compile doesn't
> do anything.
>
> -Will
>
>
> On 9/11/08 8:54 AM, "William J Sisti" <email@hidden> wrote:
>
> This worked perfectly with a nested if else.
>
> Thanks,
>
> -Will
>
> On 9/11/08 8:26 AM, "Matthew Smith" <email@hidden> wrote:
>
> on 11/09/2008 22:14 , William J Sisti at email@hidden wrote:
>
> I have a If statement that checks users user name.  Teachers use first
> initial and last name and students go by a number.  So right now my Else if
> looks like this:
>
> If (username > 1 and username <10)
>     do this
> Else if (username > 11 and username < 20)
>     do this other thing
> Else
>     do this third thing
>
> End it
>
>
> The problem is that the script doesn't like trying to figure out if wsisti
> is between 1 and 10 or 11 and 20.  "Can't make kbasovsky into type number,
> date or text".
> My alternative is to add a another question to ask if they are a student or
> teacher and handle it that way, but I would rather not.
>
> Your script is trying to convert username to a number so it can compare it
> with a number. It is a string. You can catch the error to determine if it is
> a number in a string or other type of text.
>
> set username to "abc"
> try
>    username + 10
>    set isTeacher to false
> on error
>    set isTeacher to true
> end try
> if isTeacher then
>   ...
> else
>    ...
> end if
>
>
> This will try to convert username to a number so it can add 10. The "on
> error" will be triggered if it can't convert it.
>
> ________________________________
> _______________________________________________
> 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
>
>  _______________________________________________
> 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
>



--
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

References: 
 >Re: If Statements (From: William J Sisti <email@hidden>)
 >Re: If Statements (From: William J Sisti <email@hidden>)

  • Prev by Date: Re: If Statements
  • Next by Date: Re: If Statements
  • Previous by thread: Re: If Statements
  • Next by thread: Re: If Statements
  • Index(es):
    • Date
    • Thread