Skip to content

Instantly share code, notes, and snippets.

@christianseel
Last active May 15, 2016 21:18
Show Gist options
  • Save christianseel/6addca92363ac0c5f709 to your computer and use it in GitHub Desktop.
Save christianseel/6addca92363ac0c5f709 to your computer and use it in GitHub Desktop.
AppleScript for www.alfredapp.com for Sipage. You need to be logged in at sipgate.com at the same time
on alfred_script(q)
tell application "Google Chrome"
set ActivePage to window 1
set CallTab to make new tab at end of tabs of ActivePage
set URL of CallTab to "https://app.sipgate.com/"
delay 1
set jscode to "function post(path, params, method) { method = method || 'post'; var form = document.createElement('form'); form.setAttribute('method', method); form.setAttribute('action', path); for(var key in params) { if(params.hasOwnProperty(key)) { var hiddenField = document.createElement('input'); hiddenField.setAttribute('type', 'hidden'); hiddenField.setAttribute('name', key); hiddenField.setAttribute('value', params[key]); form.appendChild(hiddenField); } } document.body.appendChild(form); form.submit(); } post('https://secure.live.sipgate.de/ajax-fast.php/account/click2dial/', {from: '2373479e0', to: '" & q & "'});"
execute front window's active tab javascript jscode
delay 1
close active tab of window 1
end tell
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment