Getting Applescript to read Arduino

Hi everyone,
First-time poster so please go easy on me   I've got an Arduino project that involves Applescript reading the Arduino's serial monitor. I think I've got the Arduino half going well, but I'm not sure how to Applescript a code that reads the results and executes an Applescript command that skips to the next track in itunes. I've been tinkering around Applescript with little success. Any help would be greatly appreciated.
A huge and many thanks in advance

I know it has been a long time but did you find a solution for your problem?
I am also playing around with the arduino mega 2560 R3

Similar Messages

  • Reading a large file?  I created an Applescript to read an XML document...

    I created an Applescript to read an XML document that had been exported from Final Cut Pro but it has trouble reading anything larger than a 1mb. Even 500kb takes a long time.
    My code is most likely very ineffecient, but I have little experience with Applescript. The script reads an XML document one line at a time then breaks down each line into it's componenents and literally reads each character looking for "<name>" then it checks to see if "<reel>" came before it. It then records the name in between "<name>" and "</name>." Then I get my list of tapes that are in the Final Cut Pro project. Does anyone have any advice on how to improve this code?
    property type_list : {"TEXT", "XML"}
    property extension_list : {"TXT", "XML"}
    on open these_items
    tell application "Finder"
    set my_file to these_items as string
    set file_ref to (open for access my_file) read
    close access file my_file
    set AppleScript's text item delimiters to ASCII character 10
    set new_list to every text item of file_ref
    set lengthofarray to length of new_list
    set h to 1
    set shotcount to 0
    set finalShots to {"You have ", "", " shots in your project."}
    set finalListoftapes to {"Your list of tapes are:", ""}
    repeat lengthofarray times
    set i to 1
    set x to 1
    set switch to 0
    set z to {""}
    set reelName to {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}
    set letter_list to item h of new_list
    set AppleScript's text item delimiters to ""
    set final_list to every text item of letter_list
    set lengthofletter_list to length of final_list
    repeat lengthofletter_list times
    if item i of final_list is "<"a" then
    if item (i + 3) of final_list is "m" then
    set letter_list2 to item (h - 1) of new_list
    set final_list2 to every text item of letter_list2
    set lengthofletter_list2 to length of final_list2
    set j to 1
    repeat lengthofletter_list2 times
    if item j of final_list2 is "<" then
    if item (j + 1) of final_list2 is "r" then
    if item (j + 2) of final_list2 is "e" then
    set x to (i + 6)
    set y to 1
    repeat while item 1 of z is not "<"
    set item y of reelName to item x of final_list
    set x to (x + 1)
    set y to (y + 1)
    set item 1 of z to item x of final_list as string
    end repeat
    if item 1 of reelName is not "" then
    set displayText to reelName as string
    set lengthofListoftapes to length of finalListoftapes
    set shotcount to (shotcount + 1)
    set k to 1
    repeat lengthofListoftapes times
    if item k of finalListoftapes is equal to displayText then
    set switch to 1
    end if
    set k to (k + 1)
    end repeat
    if switch is 0 then
    set finalListoftapes to (finalListoftapes & displayText)
    set check to finalListoftapes as string
    end if
    set switch to 0
    end if
    end if
    end if
    end if
    set j to (j + 1)
    end repeat
    end if
    end if
    end if
    end if
    set i to (i + 1)
    end repeat
    set h to (h + 1)
    end repeat
    set item 2 of finalShots to shotcount
    set finalShots to finalShots as string
    set AppleScript's text item delimiters to ASCII character 10
    set finalListoftapes to finalListoftapes as string
    set finalListoftapes to finalShots & (ASCII character 10) & (ASCII character 10) & finalListoftapes & (ASCII character 10) & (ASCII character 10) & "This list of tapes has been saved on your desktop."
    set path_list to these_items as string
    set filepath to path_list & "_listoffiles.txt"
    set outputFile to (open for access file filepath with write permission)
    write finalListoftapes to outputFile
    close access outputFile
    display dialog finalListoftapes
    end tell
    end open

    Try changing your approach - don't read it into an array, process it one line at a time. Obviously any approach where you have the whole file in memory is going to exceed memory at some size of the file.

  • Getting applescript to open

    I don't know any code but, I have been wanting to get applescript to open various applicacations when I turn on/reboot my computer.

    '... I have been wanting to get applescript to open various applicacations when I turn on/reboot my computer.'
    01. Copy the code below ...
    set application_List to {"iCal.app", "Stickies.app"} -- List of applications.
    set up_Time to do shell script "uptime | awk {'print $3'}" -- Obtain uptime minutes, or hours and minutes, values.
    -- The '5' below is for '5 minutes', enough time for a Macintosh to boot. Much less time than the Mac is typically ON.
    if ((not (up_Time contains ":")) and (up_Time < 5)) then -- If on for less than '5' minutes - launch desired applications.
    repeat with i in application_List -- Cycle through the list of applications, to launch.
    tell application i to launch -- Or use 'activate', in place of 'launch'.
    end repeat
    end if
    ..., and paste it into 'Script Editor' ('/Applications/AppleScript/').
    02. Save the code, via the 'File, Save' menu item, selecting 'Application' from the 'File Format:' popup menu. You have just created an AppleScript applet.
    03. Launch (open, run) 'System Preferences', and click on the 'Accounts' utility.
    04. Click on 'Accounts' 'LogIn items' tab.
    05. Drag the AppleScript applet onto the 'Accounts' window's list.
    06. Click on the 'System Preferences' window's (now retitled 'Accounts') 'red' jelly bean crayola crayon 'close' button.
    Only when the Mac is rebooted, or turned OFF and later turned ON, will the above applet execute, and the listed applications launched.
    If you were to log out and log back in - into the same account, the applet will be executed; but, the listed applications will not be launched..
      Mac OS X (10.4.2)  

  • Applescript to read data from text file

    Hello all, I am writing an Applescript to read a file and put that file's contents into a variable. However, when I use the applescript command "read", I get the error:
    The text file reads "4.65". I need to extract that number to show up in a dialog box. This is the code I have so far.
    set milefile to ("Macintosh HD:Users:RyanSiebecker:Documents:Scripts:Source-Files:Running-Files:milefile.tx t")
    set theFileContents to (read file milefile)
    I am stuck and I cannot find any other way to do this.
    As always, any help is appreciated.
    Thanks, Ryan

    Have you noticed that your file name's extension (".tx t") has a space in it?  Though that mismatch would get a -43 Not Found error, not EOF.
    Your code ( with and without the gapped extension) works here. 
    Maybe the path isn't perfect?
    To make a perfect path easily, start with this:
         set milefile to POSIX file ("")  -- note the null string ("")
    Then arrange your windows so that you can drag the icon representing your file from wherever it is in the Finder's world into your AppleScript Editor's window, and carefully drop it right between the ""s.
    If you miss, don't worry.  It'll be selected, so just Cut and then Paste it between the ""s.  You'll get a perfect path, only with slashes instead of colons.  The "POSIX file" specifier converts it to "colon notation", still perfectly.
    --Gil

  • The latest update to Firefox 3.6.14 has twice closed and disabled the program so that it will not re-start. Instead I get a message reading "The application was unable to start correctly (0x0000056). Click OK to close the application"

    The error console suggests that there is a missing semicolon in the code. It's unclear whether this is in the Firefox code or the Java script code, or for that matter whether it's the source of the problem. In any event the only way both times I have been able to get Firefox to work again is to download and reinstall it again. How can I stop this cycle and get Firefox to update correctly? My computer runs Windows 7, 64-bit.

    I was almost driven crazy by this problem. My Premiere CS6 displays error 0xc000007b exactly like your situation. I tried every method on the internet but none of them worked.
    Including copying the msvcr100.dll to the Premiere folder. Nothing happened.
    But this one sounds reasonable, comparing to some guess like video card problem or something.
    Since I don't use ilivid or something like this. So I thought maybe there was some file else which my computer lacked.
    But I don't know what it is.
    Then I got an idea.
    Here is what I did:
    Copy all the AE CS6 .dll file in "Support Files" folder.
    Backup all the .dll files in Premiere CS6 folder.
    Paste and replace them all!
    Then I found that Premiere Pro was able to start up. But unfortuately, it stopped in half.
    Well. Maybe I shouldn't click "replace".
    So I went back to the backup folder. Copied the origin .dll files.
    Paste and replace again!
    That's equal to choose "Not replace" at the first time.
    Now everything came back to normal.
    I want to get a sleep.

  • When I read an email on my iPad it remains unread on my macbook. How do I get it to "read" the e-mail on both?

    When I read an email on my iPad it remains unread on my macbook. How do I get it to "read" the e-mail on both?

    I ahve this problem too, my macbook is set up as an imap account for gmail, say I get an email and it shows as new in my gmail, iphone and macbook, and I then read it in my gmail, it is marked read on my iphone but stays as unread on my macbook.
    This is really annoying as if I read emails during the day on another computer I can come back to them all being new on the macbook.
    Is there a fix for this?

  • My macbook is loaded with microsoft work and every time I try and open the program I get an error reading and it will not open.  Powerpoint and the other applications still respond!

    my macbook is loaded with microsoft word for macs and every time I try and open the program I get an error reading and it will not open. This is what it says:
    The application Microsof Word quit eunexpectedly.  Powerpoint and the other applications still respond!

    The joys of Microsoft!
    Maybe the preferences file is corrupted.  You should be able to find the Word preferences file in the folder:
    your user name/Library/Preferences
    Its name is com.microsoft.Word.plist
    I suggest you drag this another folder and try Word again. 
    If that doesn't work then you might find clearing the cache files will fix the problem.  You can do this manually but I never bother. Instead I use a program like Snow Leopard Cache Cleaner (shareware) or Onyx (free). These programs do lots of other maintenance jobs so it's worth having at least one of them.
    Bob

  • How do you get applescript to say multiple things simultaneously?

    I'm quite new to applescrips, and although I've written some basic scripts, I can't really do anything useful (since I have no knowledge of how to use Terminal commans or how to run shell scripts).
    I've been trying to get applescript to say multiple things at once, in the same OR in different voices, whatever. No matter what I've tried, it either waits for what it's currently saying to finish before saying a new line, or it cuts off all lines but the last one before speaking.
    I've tried say all by itself, with stopping current speech, without waiting until completion, or with both of those last 2 at once, like shown here:
    say "TESTING" using "Agnes" with stopping current speech without waiting until completion
    say "TESTING" using "Alex" with stopping current speech without waiting until completion
    (Take off whatever endings you want, I don't even like those there.)
    None of them worked. Also, putting a delay in between doesn't work either.
    I've also tried saving applescripts that say something as their own scripts and opening those with a different one, like so:
    run script file "Macintosh HD:Users:MY NAME:Library:Scripts:TESTING1.scpt"
    run script file "Macintosh HD:Users:MY NAME:Library:Scripts:TESTING2.scpt"
    But that didn't work either.
    I'm stuck and neither Google nor any Apple support threads I could find could help me.
    Any help would be much appreciated, thanks.

    You can try a script I have, and work from that:
    set anSwer to the text returned of (display dialog "What text do you want to say?" default answer "") as text
    set the_names to {"Fred", "Bruce", "Alex", "Albert", "Ralph", "Junior", "Vicky", "Agnes", "Kathy", "Princess", "Victoria"}
    repeat with this_name in the_names
              tell application "System Events"
                        try
                                  say "Using" & this_name & "'s  voice..., " & anSwer using this_name
                        on error
      display dialog "Didn't Work" giving up after 3
                        end try
              end tell
    end repeat

  • How do is get back to Read & Write permissions on HDs ?

    Hi gang,
    I was trying to set up one central folder for 4 iTune users (accounts) in our household.
    One of the blogs said put in "Shared" folder and set permissions to "Read & Write".  I tried but on "Everybody" is does not offer the "R&W" option, just "Read".  They also said to be sure you clicked "Apply to Enclosed Items" in the drop down.  Although I could not set "Everyone" to "R&W", I clicked on "Apply to Enclosed Items" and the hard drives clicked for at least 15 minutes.
    Afterward I got a pop up that said...   System Extension "/System/Library/Extension/ACard6280ATA.kext" was installed improperly and can be used.  Try reinstalling.  and an OK button to click.  I clicked OK and at least 100 more popup appeared, one after the other as I clicked OK.   They all had the same basic message except the info after  /System/Library/Extension/, it kept changing slightly on each new popup.
    The big problem is I now have three of my four internal hard drives locked to my access and all they say custom on the permissions Privilege window.   Only my main HD is working, thank God.
    How do I get back to Read & Write on Privileges, and on all Hard Drives?
    Thanks for any help, I just made the move to MAC but have good background with windows operating system.
    Gary

    Thanks for all the reply's, I really appreciate your time.  I have Apple Care so I worked with Apple tech last night and today, but they had to pass problem on to their engineers.  They did a great job trying to help and spent 2 hours helping me input in code through the Terminal screen.  It helped a little, but we still can access drive 2, 3 and 4 due to the global permissions that were changed.   All in all, it looks like we have to reinstall the OS on a washed HD.
    I found out that the Repair program (Disk Utilities) only repairs permissions that were created after the initial set up.  It won't correct original setting and that's what happened when I clicked on "Apply to Enclosed Items" at the root level.  Likewise Time machine does not clone the main operating system so a restore would probably not get all the pieces back in their proper places.
    I was thinking of doing a reinstall of the whole Mac HD drive (boot drive) with an exact copy I made with Carbon Cloner a month back, but the techs seem to think they will have to work on of the 4 individual HD I have.
    Thanks again for the quick responses, I will let you know what happens in a few days.
    Gary

  • Why does ATT use fake member messages to get you to read a "how to" page?

    I signed in online today on my desktop computer to pay my ATT wireless bill - of course 10 days early as I do every month.  We have 2 wireless phones on our plan with ATT and no other services. After signing in, I was surprised to see multiple messages in my message center.  The only time I get email messages sent to my phone from ATT is when I've paid my bill and it confirms payment so it was unusual to see this. I clicked on "my messages" and I probably had 20 messages with today's date.  All were ATT notices such as "People in my area having problems with data", problems with texting, new ways to dial local, all things like this.   But - I received the following message and I am typing this EXACTLY: Did you know that your mobile service is suspended?  Reactivate now.   And the message is the link in my account to click on to go further.  I was shocked and checked my phone right away and it was working, then ask my husband if his working and it was also.  My bill is current and is always current.    I couldn't understand what was wrong.  So I click on the first link and this is the next message (copy and paste) from ATT and with my name and account number: From: A message from AT&TReceived: 07/08/2015 8:13 PM  (The time changes every time I sign in to the current time). Service for one or more of your mobile phones or devices is currently suspended. You can reactivate service here.   (The word "here" above was actually a hilighted word that is the link to the next page of ATT's message to me and I have changed that above to a regular typed word w/o the link). At this point I'm thinking my account is having some major problems and can't figure out why.  I click on this link and go to the next page and it is a whole thing on how to re-activate or suspend my phone.  I had no clue at this point and called ATT.  The service rep I talk to has no clue either why these messages are on my account and I gave her permission to look through them.  All she can figure is that it is some kind of advertisement / help screen for a "how to".  This call took about 20 minutes of my time and I really got no where and I'm very ticked off.  She did determine that my account is NOT suspended and that it is current. ATT this is RIDICULOUS, there is no one to remove this junk off of my account and ATT should not trick people into clicking on a message to get them to read a "how to" by sending a message telling them that their account is suspended and to re-activate it.  How dare you.  This needs to be removed off of my account and every other person that you have sent this to and NO I am not going to delete it myself.  There isn't one person out there who would have received this message from ATT and not perceived it EXACTLY the same way I did.  And every time I sign on it looks like a new message because it changes the time on it.  You've really sunk to an all time low by doing this.      

    My response was just as puzzled, but not as annoyed about the messages. I don't know why the 8th was bombed with "junk mail". I never read it as it is also forwarded to my email, usually junk, and doesn't app,y to me. I was amused that many were duplicated in Spanish (not pleasantly amused).
    Because I delete the emails, and never bother with the messages, I didn't realize I had more tha a years worth sitting in my account. It said (4) next to Messages. But there were several pages and it was closer to 50.
    No way to answer, or spam either.
    I sent an inquiry, I will let you know if I get a response.

  • I have an Ipad 2 and are having problems sending out emails in one of my email address. I always get a message reading the email was not sent because the server does not allow relaying. This is an email account POP3. I have no such problem with gmail.

    I have an Ipad 2 and are having problems sending out emails in one of my email address. This is a POP3 email Account? I always get a message reading that the email was not sent because the server does not allow relaying. I have no such problem with gmail. What could be the problem and how do I resolve this. Is it about settings?
    Richard.

    Welcome to the Apple community.
    If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact Apple ID Support, upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
    The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
    The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
    Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
    Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
    Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do.

  • How to get rid of  Reading List and why my add page going in there?

    My + on the toolbar is now adding pages to the reading list instead of the bookmark.. How do i change that/get rid off reading list? I want stuff to go to bookmark. I tried to change the setting in  in Safari>Preferences>Bookmark but I dont have a bookmark option.. Very annoying. I updated to 10.9.1 version. Help!

    Click and hold the button to add a bookmark.

  • How many images per sec can I get from ImageIO.read(url) ??????

    Hello,
    In my program I read images from a url...I'm wondering how many images I can get with ImageIO.read(url) per second..
    Hereby is the code that I'm using:
    import java.awt.*; //Contains all of the classes for creating user interfaces and for painting graphics and images
    import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
    import java.awt.image.*;//Provides classes for creating and modifying images
    import java.io.*;//Provides for system input and output through data streams, serialization and the file system
    import java.net.URL;
    import javax.imageio.*;//The main package of the Java Image I/O API.
    import javax.swing.*;//Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
    import java.text.*;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class getPic extends Component{
    private BufferedImage img;
        static int n=0;
        private URL url;
        private DateFormat dateFormat;
        private Date date;
        private String s;
        private String str1= ".jpeg";
        private String str2="C:\\Users\\";
        private String str3;
        private String str4;
          public getPic() {
         try {
                  url = new URL("http://"); //a url that gives a real-time image
                  img = ImageIO.read(url);
                } catch (IOException e) {
               System.err.println("Unable to read file");
    public void savePic(){
    try{
    n++;
    str3=str2.concat(Integer.toString(n-1));
                        str4=str3.concat(str1);
                        ImageIO.write(img, "jpeg" , new File(str4));
                    } catch(IOException e) {
                      System.err.println("Unable to output results");
    @Override
        public Dimension getPreferredSize() {
            if (img == null) {
               return new Dimension(100,100);
            } else {
               return new Dimension(img.getWidth(), img.getHeight());
        @Override
          public void paint(Graphics g) {  //http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Paint.html
            g.drawImage(img, 10, 10, null);//http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics.html
        public static void main(String[] args) throws IOException {
           JFrame f = new JFrame(" Image without processing!!");
           f.addWindowListener(new WindowAdapter(){//http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/WindowListener.html
                @Override
                    public void windowClosing(WindowEvent e) {
                        System.exit(0);
        int i=0;
        for( ; ; ){
            i++;
            getPic pi = new getPic();
            pi.savePic();
            f.add(pi);
            f.pack();  //Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.
            f.setVisible(true);
         try
            Thread.sleep(1000);
            }catch (InterruptedException ie)
            System.out.println(ie.getMessage());
    }Thank you in advance for your answers
    Joan

    Finally I solved my problem(getting as many images as possible from a url infinitely) using the above code:
    import java.net.*;
    import java.io.*;
    public class UserApplication {
        private static int n=0;
        String url;
      public void UserApplication(){
        public static void main(String[] args) throws Exception {
            UserApplication app= new UserApplication();
            for(;;){
            app.urlStr();
        private void urlStr(){
            try{
                url= "http://mplamplampla/frame.php/";
                HttpURLConnection con=(HttpURLConnection) ((new URL(url).openConnection()));
                BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream("C:\\Users\\mpla\\Desktop\\" + n + ".jpeg"));
                con.setDoInput(true);
                con.setDoOutput(false);
                con.setRequestMethod("GET");
                BufferedInputStream in = new BufferedInputStream(con.getInputStream());
                int bt = 0;
                byte[] buffer = new byte[4096];
                while ((bt = in.read(buffer, 0, 4096)) > -1) {
                  out.write(buffer, 0, bt);
                in.close();
                out.close();
                System.out.println("Image " + n + " saved");
                n++;
                } catch (Exception e) {e.printStackTrace();}
    }

  • I have iphoto '08 version with an imac osx 10.5.8. It will not read my RAW files  from my Nikon D800 - a very new model.How can I get it to read my RAW files?

    my somewhat old imac osx 10.5.8 with iphoto '08 will not read my RAW files from my new Nikon D800 camera - a new model on the market( 5 months or so). How can I get iphoto to read my RAW  files?

    iPhoto 08 would not read RAW files from that new a camera. You need to upgrade so you can get more up-to-date version of OS X and iPhoto. Another possiblity is see if iPhoto 11 will run on 10.5.8, if so you should update. You can also attempt to run Software Update and see if it finds a newer release of iPhoto 08 that supports newer RAW formats.

  • I have a windows pc, and a 2Tb portable HD, this contains all my music folders, what settings do i use or how do i get itunes to read my portable HD on F;/ drive ?

    i have a windows pc, and a 2Tb portable HD, this contains all my music folders, what settings do i use or how do i get itunes to read my portable HD on F;/ drive ?

    Hopefully you have the library files on the drive too, or access to the original computer where the library still works. See Make a split library portable.
    tt2

Maybe you are looking for

  • Regarding : Selecting the adapter type in ID

    Hi, While creating the scenario in Integration Directory using wizard we will get an option of selecting sender adapter type & receiver adapter type. But while creating  manually , I am not getting the option of selecting the adapter type. Please spe

  • SP14 Multi-mapping - error in receiver idoc adapter

    Hi, I have a scenario where a business service should send some XML to SAP CRM. I get the file via a sender JMS adapter and try to post it to CRM via a receiver IDOC adapter. I have created a multimapping (1:N - 1 XML file to many Idocs) as should in

  • Bugs on Yosemite

    after installing the new OS X Yosemite, i've found some bug when open appstore the screen turn like that but on the other apps didn't have problem like that. Hope Apple fastly solve this problem. MacBook Pro - Retina Display 15" (2013)

  • Deleting specific data points from a scatter graph

    I cannot seem to figure out how to delete single points in a scatter plot to get rid of the outliers. Someone help me!

  • Warehouse Inventory List via Cycle Counting

    When printing a cycle count document in LI04, does anyone know what form the print program calls?