Thursday, July 24, 2014

#1 2005-09-17 08:02:20 am

Ray Barber
Site Admin
From: Lake Dallas, Texas
Registered: 2002-11-19
Posts: 344
Website

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!


Ray Barber
Admin | MacScripter

Offline

 

#2 2006-01-04 02:20:44 pm

Adam Bell
Administrator
From: Nova Scotia, Canada
Registered: 2005-10-04
Posts: 4631

Re: Note for Noobies

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 (that I've put in a Code box so it will show here - code is literal)

Code:

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

Without the code boxes, that becomes:

Applescript:

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


iMac & MBP both running OS X 10.9.1

Offline

 

#3 2006-06-06 06:44:24 am

hendo13
Member
From: Barrie, Ontario
Registered: 2006-06-04
Posts: 542
Website

Re: Note for Noobies

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.


That was a message from Hendo!

Offline

 

#4 2006-10-11 12:20:14 am

tombeek
Member
Registered: 2006-10-09
Posts: 10

Re: Note for Noobies

Thanks Adam and Ray.  Appreciate the information!!!

Offline

 

#5 2007-06-14 07:45:55 am

knightjp
Member
Registered: 2007-02-06
Posts: 46

Re: Note for Noobies

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

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

Thanks for the site,

Julz

Offline

 

#6 2007-06-14 10:02:11 am

jdwires
Member
Registered: 2007-06-13
Posts: 1

Re: Note for Noobies

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

Applescript:

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

________
Joel Wires


Filed under: Finder

Offline

 

#7 2007-06-14 01:46:30 pm

knightjp
Member
Registered: 2007-02-06
Posts: 46

Re: Note for Noobies

jdwires wrote:

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

Applescript:

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.


Filed under: Finder

Offline

 

#8 2007-06-21 11:09:50 am

dzelnio
Member
Registered: 2007-06-08
Posts: 48

Re: Note for Noobies

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.

Offline

 

#9 2007-08-10 04:08:27 pm

jonserr
Member
Registered: 2007-08-10
Posts: 4

Re: Note for Noobies

Applescript:

Great site!
I will post my conundrum soon.

Offline

 

#10 2007-12-29 09:10:46 pm

JerryK
Member
Registered: 2007-12-29
Posts: 10

Re: Note for Noobies

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)

Offline

 

#11 2008-09-02 04:11:49 pm

Ka Ora!
Member
Registered: 2008-09-02
Posts: 7

Re: Note for Noobies

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

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

Offline

 

#12 2010-05-11 05:13:22 pm

drmjdoyle
Member
Registered: 2009-01-17
Posts: 34

Re: Note for Noobies

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.

Offline

 

#13 2010-09-12 06:00:58 pm

umjwc
Member
Registered: 2010-09-09
Posts: 1

Re: Note for Noobies

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

Applescript:

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

Offline

 

#14 2013-04-03 05:32:52 pm

Shane Stanley
Member
From: Australia
Registered: 2002-12-07
Posts: 3521

Re: Note for Noobies

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


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.039 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)