swiimboy Posted December 28, 2016 Posted December 28, 2016 I regularly check a website truecall.co.uk and I can open it using an Alfred hotkey. The site is set up knowing my login details, so all I have to do is click on"enter" or press <return> to log in. But then I have to click on a menu selection (or press <tab> 7 times followed by <return> to get the page I want. Is there a way to do this entirely within a workflow? (I'm OK with computers, but new to Alfred. Some knowledge of elementary AppleScript) Thanks
deanishe Posted December 28, 2016 Posted December 28, 2016 You can simulate the keypresses with an AppleScript and launch that with Alfred. http://apple.stackexchange.com/questions/36943/how-do-i-automate-a-key-press-in-applescript That can be unreliable, as there's no way for the script to know if the keystrokes worked. You'll have to build in delays to give Safari time to load each page before firing the next keystroke.
Andrew Posted December 29, 2016 Posted December 29, 2016 If you don't want to use AppleScript to simulate events, you can add "Dispatch Key Combo" objects which will post key events. These could be wired after an Open URL action. You can chain inline Delay utility objects to wait for moments in between. As Dean says, this may prove unreliable as you don't know what the underlying browser has done or if the key event worked.
swiimboy Posted December 29, 2016 Author Posted December 29, 2016 Thanks for the responses. I tried Andrew's suggestion - "Despatch Key Combo" a) with no Delay items. This failed to operate correctly with 2 seconds Delay after every keystroke. This worked, but was slow (9 keystroke items) c) with 0 seconds delay after each of the 7 Tab keystrokes. This worked very well. I understand that the procedure may be erratic (presumably from 'lost' keystrokes, but such a failure is 'soft' and easily recoverable manually. Thank you again - I have what I wanted, and am wiser than I was. David
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now