Embedded Applescript Trouble

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Embedded Applescript Trouble Fri Nov 14, 2014 3:57 pm • by pruppert
I am trying to run the following embedded Applescript action. When I try to validate it in the embedded editor, I am told: expected "end" but found "property."

The script works just fine from the Applescript editor. What is going on here? How can I fix it?

Thanks.

Code: Select all
property theLocalNode : ""

on getLocalNode()
   try
      set theIP to (do shell script "ifconfig | grep inet | grep -v inet6 | cut -d\" \" -f2")
      set theLocalNode to the last word of theIP
   on error
      set theLocalNode to "Can't get Local IP"
   end try
end getLocalNode

repeat
   try
      getLocalNode()
      set textFile to path to my file
      do shell script "echo " & quoted form of getLocalNode() & "> " & quoted form of textFile
      exit repeat
      
   on error
      exit repeat
   end try
end repeat
pruppert
 
Posts: 1
Joined: Fri Nov 14, 2014 3:49 pm

Re: Embedded Applescript Trouble Fri Nov 14, 2014 4:58 pm • by Mr_Noodle
Read the help on AppleScript. You can't use handlers in an embedded script because it is already in a handler.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support