• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Keeping a text-entry in the background, or a work-around
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Keeping a text-entry in the background, or a work-around


  • Subject: Keeping a text-entry in the background, or a work-around
  • From: Clint Hoxie <email@hidden>
  • Date: Thu, 29 Nov 2007 10:42:21 -0700

I'm new on the list, so I apologize if this post doesn't match usual etiquette.

I've copied a script from Alvin Alexander and then modified it a bit. It is intended to open some URLs for me on a repeating basis. I have the script saved as an application bundle which is called as an alarm by iCal. My difficulty is that the script requires a keyboard command to enter the URL, which means that I can't be touching the machine when the script runs, or I likely interfere with its successful execution. I looked for a solution online, but don't have enough experience to know what resources I need. Can anyone help? The script is pasted below.

Thanks.

Clint

-----------------------------------
-- an applescript program that opens a list of urls in separate tabs.
-- opens safari, opens a window, then loads each url in a separate tab.
-- written by alvin alexander, devdaily.com
-- further developed and modified by Clint Hoxie
-- no rights reserved, feel free to copy and improve this program.

set urlList to {"dogpile.com", "http://www.littlegolem.net/"}
set numURLs to (count urlList)

tell application "Safari"
	activate

	tell application "System Events"
		-- open a new window to save open tabs
		tell process "Safari"
			click menu item "New Window" of menu "File" of menu bar 1
		end tell
		-- enter the url in the open window
		keystroke (item 1 of urlList)
		key code 36
		repeat with i from 2 to (numURLs)
			-- for each additional url, first create a tab
			tell process "Safari"
				click menu item "New Tab" of menu "File" of menu bar 1
			end tell
			-- now enter the url
			keystroke (item i of urlList)
			key code 36
		end repeat
	end tell
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Keeping a text-entry in the background, or a work-around
      • From: Jon Pugh <email@hidden>
    • Re: Keeping a text-entry in the background, or a work-around
      • From: Peter Baxter <email@hidden>
    • Re: Keeping a text-entry in the background, or a work-around
      • From: Malcolm Fitzgerald <email@hidden>
    • Re: Keeping a text-entry in the background, or a work-around
      • From: "J. Stewart" <email@hidden>
References: 
 >How do I use UI scripting to click a button in a save dialog in TextEdit in Leopard? (From: Laine Lee <email@hidden>)

  • Prev by Date: How do I use UI scripting to click a button in a save dialog in TextEdit in Leopard?
  • Next by Date: File length limitation when using a droplet's "on open" handler?
  • Previous by thread: How do I use UI scripting to click a button in a save dialog in TextEdit in Leopard?
  • Next by thread: Re: Keeping a text-entry in the background, or a work-around
  • Index(es):
    • Date
    • Thread