Applescript with Excel

Discussion in 'Mac Programming' started by tayjayt, Jun 27, 2012.

  1. tayjayt, Jun 27, 2012
    Last edited by a moderator: Jun 27, 2012

    tayjayt macrumors newbie

    Jun 27, 2012
    San Francisco
    I am using Applescript to automatically calculate an excel spreadsheet every second, in order to accurately keep time on an hours spreadsheet for work. Here is the command line:
    global iteration_interval
    on idle
    	tell application "Microsoft Excel"
    		end try
    	end tell
    	return iteration_interval
    end idle
    on run
    	set iteration_interval to 1
    end run
    I am running this as an application, and it works for what I need it to, but it is sloppy for a few reasons.

    I want the application to open the file called “Hours.xlsm” when I open the app (which I have called “Runner”). I know I can specify the path to “hours.xlsm”. ie. TaylorJames:Desktop:OG:Hours. That is sloppy, because I want to be able to move the file around, share, etc., and have the application search for it and open it wherever it is stored. Maybe I can even store the spreadsheet within the application resource contents?

    The next problem is this. When the application “Runner” is operating, I cannot work in any cell in the spreadsheet, or any other spreadsheet for that matter, because obviously it is calculating every second. Can I specify the cells that it calculates, or at least the spreadsheet? Maybe I’m asking too much or maybe I should use a more robust programming tool. Applescript, I know, isn’t anything close to Java. Any help so very much appreciated! Regards, Taylor.
  2. kryten2 macrumors 6502a

    Mar 17, 2012
    Took a look at the mdfind and mdls commands. Man mdfind and man mdls will give you more info on how to use them.

    Open the Excel dictionary in Script Editor.

    Quote from the Excel 2004 dictionary :


    Attached Files:

Share This Page