The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   OS X Developer (http://hintsforums.macworld.com/forumdisplay.php?f=27)
-   -   applescripting a javascript form (http://hintsforums.macworld.com/showthread.php?t=100814)

thompsonsol 04-26-2009 07:54 AM

Used Keystrokes in the AppleScript?
 
Have you tried using keystrokes and clicks with AppleScripts. I use it to login to Google Mail automatically:
http://applescripts.thompson-solutio...i_mac_os_x.php

Reference Keystroke materials can be found below at:
http://applescripts.thompson-solutio...oard_guide.php

roncross@cox.net 04-26-2009 01:05 PM

Quote:

Originally Posted by djeans (Post 529981)
This works, albeit very slowly. For some reason, there is a long pause after the popup button is pressed (about 5 seconds) before it arrows down to the next selection even though there is no delay statement between the two actions.

If you see anything I can change to clean up the code to make it faster, let me know.

The next task will be getting the information that is returned in table form copied into an email - if you have any suggestions in that regard :)

D

I think you are on the right track. Forget the set menu_item to "Honolulu" as string ....
You might want 5 seconds delay if you are hearing beeps. Once you get the scripts to work, you can reduce the delays.
Code:

tell application "System Events"
tell application "Safari"
        activate
tell (make new document) to set URL to "https://intranet.locations/"
        delay 5
click pop up button 1 of group 3 of UI element 1 of scroll area 1 of UI element 1 of scroll area 2 of UI element 1 of scroll area 1 of group 3 of window "Main"
delay 5
repeat "number of times it takes to get to Honolulu in the popup window"
key code 125
delay 5
end repeat
keystroke return
delay 5
end tell
end tell

In this case, you are putting the key down stroke in the repeat loop for the number of times it takes to get to the Honolulu in the pop up window assuming it is always in the same position. If it's always in the same position, you are good to good, otherwise, I'm afraid that I have run out of ideals...:confused:

Be sure to spell the menu items correctly or else it will cause a beep.


All times are GMT -5. The time now is 05:35 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.