• 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
Re: Prevent asking to locate application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prevent asking to locate application


  • Subject: Re: Prevent asking to locate application
  • From: Walter Ian Kaye <email@hidden>
  • Date: Sun, 28 Mar 2004 22:46:17 -0800

Umm... you realize you can use the 'set' command instead of pasting, right?

At 11:29p -0600 03/28/2004, Joseph Weaks didst inscribe upon an electronic papyrus:

on pasteInWord()
tell application "Microsoft Word"

set selection to the clipboard -- or to a variable if bypassing the clipboard

end tell
end pasteInWord

on pasteInAppleworks()
tell application "AppleWorks 6"
activate
if not (exists document 1) then make new document at front with properties {document kind:text document}

set selection to the clipboard -- or to a variable if bypassing the clipboard

end if
end tell
end pasteInAppleworks



Also, with the current setup, I was thinking I could place each handler into a string and then run that script as a string. It wouldn't compile and so the app that folks didn't have would never get searched for. Something like

set AppleworksScript to "tell application \"AppleWorks 6\"
activate
if not (exists document 1) then make new document at front with properties {document kind:text document}
delay 1
paste
delay 1 --give it time to update
end if
end tell"

if theApp is "Appleworks" then
run script AppleworksScript
else if...

No need to get that messy.

I'm starting to think that individual handlers is a stupid way to do all this. Perhaps I should use something more like:

tell app theApp to activate
if theApp is "Appleworks" then
--Appleworks code
else if theApp is "Microsoft Word" then
--Word VBA code
....
end if


You agree?

Yes, especially since 'set selection' works for both apps you've coded for.


-W
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Prevent asking to locate application
      • From: Joseph Weaks <email@hidden>
References: 
 >Prevent asking to locate application (From: Joseph Weaks <email@hidden>)
 >Re: Prevent asking to locate application (From: Hanaan Rosenthal <email@hidden>)
 >Re: Prevent asking to locate application (From: Joseph Weaks <email@hidden>)
 >Re: Prevent asking to locate application (From: Walter Ian Kaye <email@hidden>)
 >Re: Prevent asking to locate application (From: Joseph Weaks <email@hidden>)

  • Prev by Date: Does Powerpoint supports Apple scripts
  • Next by Date: Re: AppleScript & HTML Again...
  • Previous by thread: Re: Prevent asking to locate application
  • Next by thread: Re: Prevent asking to locate application
  • Index(es):
    • Date
    • Thread