Re: gui scripting - paste script not working
Re: gui scripting - paste script not working
- Subject: Re: gui scripting - paste script not working
- From: deivy petrescu <email@hidden>
- Date: Sun, 8 Jun 2008 11:33:36 -0400
On Jun 8, 2008, at 11:18, Vince Angeloni wrote:
Hi,
This script will copy the data to the clipboard, but the GUI
scripting part does not seem to be working. I run it as an
application and it runs but does not paste the clipboard into the
frontmost application. The info _is_ in the clipboard as I can paste
it in manually after the script runs. Any clues as to why the GUI
scripting part isn't working?
Thanks
vince
Vince , you think that it does not paste. It tries but it can't
Your app, the script saved as an app is the frontmost application.
you try to paste, but there is no where to write to.
You want to past it in what app?
Set that App to the front process and it will very likely work.
------------
set myName to "John Q. Public"
set myStreet to "123 Main St."
set myCity to "Anywhere"
set myState to "PA"
set myZip to "18452"
set mydivider to "=============" & return
set myURL to "http://www.myurl.com"
set myemail to "email@hidden"
set Paste_content to myName & return & myStreet & return & myCity &
", " & myState & " " & myZip & return & mydivider & myURL & return &
myemail
set frontApp to getfrontmostappname()
tell application frontApp
activate
set the clipboard to Paste_content
tell application "System Events"
tell process frontApp
keystroke "v" using {command down}
end tell
end tell
end tell
--returns the name of the current frontmost application
on getfrontmostappname()
tell application "System Events"
set frontmostapps to every application process whose frontmost is
true
set frontmostappname to name of item 1 of frontmostapps
--- frontmostappname is your application, not the one you want to
write to.
end tell
return frontmostappname
end getfrontmostappname
deivy
_______________________________________________
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