AppleScript help

Discussion in 'Mac Programming' started by VolceOntra, Aug 13, 2012.

  1. macrumors regular

    VolceOntra

    Joined:
    Apr 25, 2007
    #1
    Hi,

    I'm wondering if someone will help me write a simple applescript that will ask a user to enter a series of times in seconds and then have it beep after every time those seconds pass.

    all I could come up with is a static method using:

    delay 4
    beep
    delay 9
    beep

    Extra points if I could save or over lap the beeps over an mp3 file


    :) I appreciate it
     
  2. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Code:
    display dialog "Enter a series of times in seconds like 1 2 3 etc" default answer "1 2 3"
    set theTimes to text returned of the result
    try
    	set oldDelims to AppleScript's text item delimiters -- save their current state
    	set AppleScript's text item delimiters to {" "} -- declare new delimiters
    	set these_items to the text items of theTimes
    	set AppleScript's text item delimiters to oldDelims -- restore them
    on error
    	set AppleScript's text item delimiters to oldDelims -- restore them in case something went wrong
    end try
    repeat with anItem in these_items
    	delay anItem
    	beep
    end repeat
     
  3. thread starter macrumors regular

    VolceOntra

    Joined:
    Apr 25, 2007
    #3
    That's awesome. Thank you so much. Is there any way to save the beeps to an MP3 or overlay them onto of an MP3?
     
  4. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #4
    The only thing I can think of is Audio Hijack Pro. It's able to hijack System Audio.
     

    Attached Files:

  5. thread starter macrumors regular

    VolceOntra

    Joined:
    Apr 25, 2007
    #5
    Thank you so much sir
     

Share This Page