Editorial Workflows

Bounceback - Editorial edition

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Bounceback - Editorial edition is a simple hub for iOS URLs. You can even save URLs to the iOS home screen. One example automation is a URL that launches Pythonista and executes a script in one tap from the home screen.

Shared by: Gerzer

Comments: Comment Feed (RSS)

Tim — 30 Aug 2014
God bless you, sir or madam. God. Bless. You.

This changes *everything*.
Gerzer — 21 Sep 2014
Thanks!

+ Add Comment

Workflow Preview
Get File Contents ?
File Name
bounceback_data.txt
In Dropbox
OFF
If File Does Not Exist
  • Empty Output
  • Stop Workflow
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Set File Contents ?
File Name
bounceback_data.txt
In Dropbox
OFF
New Text
If File Does Not Exist
  • Create
  • Stop Workflow
…End If
Filter Lines ?
Output Lines That
  • Contain
  • Don't Contain
  • Match Regular Expression:
://
Output Format
  • Only Lines
  • Lines and Ranges
Find / Replace ?
Find
,
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
Set Variable ?
Variable Name
contents
Value
Input
Show Alert ?
Title
Mode
Message
Select a mode:
Button 1
Open URL
Output Value
open
Button 2
Edit URL list
Output Value
edit
Button 3
Add URL to home screen
Output Value
home
Show Cancel Button
ON
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
open
Select from List ?
Title
URLs
List (Lines)
contents
Multiple Selection
OFF
Show in Popover
OFF
Open URL ?
Open in
  • In-App Browser
  • Default App / Safari
URL
Input
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
edit
Show Alert ?
Title
Edit mode
Message
Select an edit mode:
Button 1
Edit existing URLs
Output Value
exist
Button 2
Add new URL
Output Value
new
Button 3
(don't show)
Output Value
Show Cancel Button
ON
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
exist
Custom UI ?
User Interface
Presentation Style
  • Sheet
  • Full-Screen
  • Popover
Output
Use Editor Theme
ON
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
new
Custom UI ?
User Interface
Presentation Style
  • Sheet
  • Full-Screen
  • Popover
Output
Use Editor Theme
ON
…End If
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
home
Select from List ?
Title
URLs
List (Lines)
contents
Multiple Selection
OFF
Show in Popover
OFF
Run Python Script ?
Source Code
import plistlib
import BaseHTTPServer
import webbrowser
import uuid
from io import BytesIO
import Image
import photos
import notification
import console
import workflow

class ConfigProfileHandler (BaseHTTPServer.BaseHTTPRequestHandler):
	config = None
	def do_GET(s):
		s.send_response(200)
		s.send_header('Content-Type', 'application/x-apple-aspen-config')
		s.end_headers()
		plist_string = plistlib.writePlistToString(ConfigProfileHandler.config)
		s.wfile.write(plist_string)
	def log_message(self, format, *args):
		pass

def run_server(config):
	ConfigProfileHandler.config = config
	server_address = ('', 0)
	httpd = BaseHTTPServer.HTTPServer(server_address, ConfigProfileHandler)
	sa = httpd.socket.getsockname()
	webbrowser.open('safari-http://localhost:' + str(sa[1]))
	httpd.handle_request()
	notification.schedule('Tap "Install" to add the action to your homescreen.', 1.0)

def main():
	label = console.input_alert('Action title', 'Enter a short title for the homescreen action:', '', 'Continue')
	if not label:
		return
	url = workflow.get_input()
	if not url:
		return
	icon = photos.pick_image()
	if not icon:
		return
	console.show_activity('Creating action shortcut...')
	data_buffer = BytesIO()
	icon.save(data_buffer, 'PNG')
	icon_data = data_buffer.getvalue()
	unique_id = uuid.uuid4().urn[9:].upper()
	config = {'PayloadContent': [{'FullScreen': True,
            'Icon': plistlib.Data(icon_data), 'IsRemovable': True,
            'Label': label, 'PayloadDescription': 'Configures Web Clip', 
            'PayloadDisplayName': label,
            'PayloadIdentifier': 'com.gerzer.shortcut.' + unique_id, 
            'PayloadOrganization': 'gerzer', 
            'PayloadType': 'com.apple.webClip.managed',
            'PayloadUUID': unique_id, 'PayloadVersion': 1,
            'Precomposed': True, 'URL': url}], 
            'PayloadDescription': label,
            'PayloadDisplayName': label + ' (Shortcut)', 
            'PayloadIdentifier': 'com.gerzer.shortcut.' + unique_id,
            'PayloadOrganization': 'gerzer', 
            'PayloadRemovalDisallowed': False, 'PayloadType': 
            'Configuration', 'PayloadUUID': unique_id, 'PayloadVersion': 1}
	console.hide_activity()
	run_server(config)

if __name__ ==  '__main__':
	main()
…End If