Note for Noobies

If you are new to AppleScript, and particularly if you are new to BBS, welcome! You’ve found the right place to ask for and get an answer or a link to an answer.

Why this intro? Because it is so common nowadays to jump into the middle of a site from a search engine link that many folks don’t ever go in through the front door and don’t take advantage of the rest of the huge collection of AppleScript wisdom available in MacScripter.

MacScripter is divided into this bbs (the forums), ScriptBuilders, Automator Actions, Scripting Additions, Resources/Books, unScripted, AppleScript FAQ, AppleScript Links, and Scriptable Applications sections. A brief description of these can be found here.

Enjoy!

Here in the forum, it is really useful for getting results if you take advantage of the AppleScript button above the text box for posting. Clicking that produces a bbcode pair: [applescript][/applescript]. You can either click the button and paste your code in between the tags or paste the code first in, select it, and then click the button. The result should look something like this:

When it appears in the forum, it’ll look like this:

-- paste your script here, even if it won't compile
display dialog "Hi There!" buttons {"Hi"} default button 1

and by clicking on the “Open this Scriptlet in your Editor” link at the top of the box, the enclosed script will load into the viewers Script Editor (with their permission) automagically. It makes helping you much easier for others.

Also, this forum does not automatically subscribe you to a thread you want to watch. You have to do it at the bottom of the page.

i’m really new to applescript and i posted something in code exchange (that does work) but some people kind of shunned it away not thinking the possibility that I’m new and still learning code.

Thanks Adam and Ray. Appreciate the information!!!

Hey Ray,

I’ve been a member of this site for quite some time now and I must say… Its so helpful.

I’m new to applescript. I started working on a script some time ago and then suddenly lost focus on it. Busy with other projects and stuff. But anyways, whenever I needed advie or suggestions, I always got my answers very easily and very quickly. Some members even took the time to write up the script for me…:smiley:

Well their versions, didn’t exactly match what I was aiming at, but they were good guides.

Thanks for the site,

Julz

I’m new but hoping to learn a lot. Thanks in advance for the help!

tell application "Finder" to display dialog "I love this stuff!" buttons {"Get coding!"}

Joel Wires

Welcome Joel,

You are going to like this place. If you are passionate about Applescript, its the place for you.

I started visiting a couple of weeks ago and it has been so valuable. Some observations:

  1. Search first and ask questions to follow up.
  2. Small problems are more quickly answered than big ones. Don’t ask someone to diagnose a huge script when you can focus in on the problem portion.
  3. Save your scripts by version number to avoid file-mania and losing track.
  4. Work entirely within Applescript where possible, especially when dealing with Excel. I tried to do combinations of AS and Excel macros and ended up with a mess. I still have a combo, but much more AS than Excel.
Great site!
I will post my conundrum soon.

Hello, thanks for having me aboard. I’ve been interested in AppleScript for a few months or so and stumbled across your Site. I visited some of your forums and liked what I saw and when I tried one of your snippets that encrypted and decrypted text messages, I was so impressed that I had to sign up for a membership. Great Site! Now, time to check out some more snippets! Thanks again.

Model: eMac G4 1.25 GHz
Browser: Safari 523.12.2
Operating System: Mac OS X (10.4)

Hello every one. New to Applescripting going to try my best.

One of the many converties want to learn more about the Os.

I have multiple text books on applescript, but syntax is difficult for me. This site has been wonderful in providing help. I hope to keep learning from the few dedicated people who seem to consistently take time to help people with less experience like myself. Thank you so much.

MacScripter,

I have written my first script below to show a Quicktime movie one frame at a time with an output to the serial port on an Arduino. The intent is to present frames with a signal to a camera which will photograph (real film) each individual frame. This is for the experimental film maker son of mine. I am curious that the script runs and signals the frames in the “dinky” little beginning part (see comments) and after the film is stepped one frame at a time but does not send the trigger for the camera during the stepping of the film.

The distinction between the loops that work and the one that does not is the nesting within a tell to Quicktime for stepping the frames. I have spent a good part of a day tying to find any reference to forcing applescript to treat the serialport write as though it were outside the “tell document” range without success. In writing the script, I assumed that since the serialport is not defined as a command to Quicktime, it would not be treated as a command to Quicktime’s document feature.

Any idea how to fix this rather simple script?

J. Chapman
University of Michigan Physics

set the increment_amount to 1
set the port_on_delay to 0.25
set the light_delay to 0.5
set the on_char to "1"
set the off_char to "0"
set the port_off_delay to 1
set the limit to 5

set thePorts to serialport list
set port_name to choose from list thePorts

try
    set usbserial to serialport open port_name bps rate 38400
on error theErr number errNum
    if usbserial is -1 then
        display dialog "serial port is in use " & usbserial
        return "ERROR: " & theErr & " --- " & errNum
    end if
end try

delay the port_on_delay
set the counter to 0
repeat while counter is less than limit  -- this is the repeat loop that does 5 pulses successfully
    say "doing " & counter
    serialport write on_char to usbserial for 1
    delay the light_delay
    serialport write off_char to usbserial for 1
    delay 1
    set counter to counter + 1
end repeat
say "beginning Quicktime"
tell application "QuickTime Player"

    try
        if not (exists document 1) then
            error "No movies are open."
            stop every document
            return
        end if
        tell document 1
            set the movie_length to the duration
            rewind
            repeat while the current time is less than the movie_length
                step forward by the increment_amount
                delay 1
                (serialport write on_char to usbserial for 1) -- this is the output that never comes??
                delay the light_delay
                (serialport write off_char to usbserial for 1) -- nor this one
            end repeat
            say "finished movie"
            rewind
        end tell
    on error error_message number error_number
        if the error_number is not -128 then
            beep
            display dialog error_message buttons {"Cancel"} default button 1
        end if
    end try
end tell
set the counter to 0
repeat while counter is less than limit -- and again in this repeat loop works!
    say "doing " & counter
    serialport write on_char to usbserial for 1
    delay the light_delay
    serialport write off_char to usbserial for 1
    delay 1
    set counter to counter + 1
end repeat
serialport close usbserial
return

There are two ways to remove the code form QuickTime’s scope: (a) move it into a subroutine, or (b) wrap the relevant code in “tell current application/end tell”.

Hey everyone,

Really looking forward to exploring this forum :slight_smile:

I’ve only recently got into Applescript, and I absolutely love it! I’ve always been into Mac automation, so I’m not sure why Applescript didn’t catch my eye long before now!

I’m trying so hard to learn it. I’ve got 4 books and a couple of online video tutorials that I’m using. I have to be honest; I’m not finding it easy at all. It’s just not clicking with me!

I will persevere! :slight_smile:

Anyway, just wanted to say hello and hope to get to know some of you guys as my journey continues :slight_smile:

Hi gezmacOS. Welcome to MacScripter!

Different people have different ways of learning, depending on who they are, where they’re starting, and what they’re used to. Books and tutorials may be either good or bad and are written by people who hope they’re making sense but can only guess at what any particular reader’s going to ‘get’ or not. It’s a matter of working through the material gradually, trying out any examples, and experimenting with those which grab your curiosity until you begin to get a feel for how they work. The picture gradually builds up. Also, of course, you can ask here and hope that one of us can answer in a way which makes sense. :slight_smile:

Thanks Nigel!

I couldn’t agree with you more. I’m a qualified trainer so I know it’s all about trying various different ways to learn. I think my frustration is I’ve been at it for a few months now and I don’t feel as if I’ve left the starting point :o

My impatience does not help one bit :rolleyes:

As I say I’ll stick at it, delighted I found this site too :cool:

Hi all Mod and Admin,

I also very new to AppleScript. I hope I can learn more when I join to forum. Please forgive me if I have a silly question.

Love to learn new thing everyday.

Cheers,
Tony

Hello everyone, I am new to this thread. My name is Silvia Howell and I hope to learn a lot of interesting things and quickly learn how to use the program.