Open the script and hit the ranch button at the top of the screen.
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by Jozh
-
RE: Home screen Icon
-
RE: Duplicate/Copy a workflow
Copy the workflow that you want as your template the hit the + button for making a new workflow. You should see an option that say From clipboard.
-
RE: Is there a way to highlight text in editor and preview
You can do it from the keyboard snippets.
-
List help
How do you make this work
import dialogs text = '''the tree going''' dialogs.edit_list_dialog(title='', items= [text], move=True, delete=True)```
-
RE: How to specify folder when creating new file?
editor.set_file_contents(name, new_contents[, root])
Writes new data to the file with the given name (a relative path). If a file with this name exists, it is overwritten.Note that new_contents is a byte string, which means that you can also use this to write binary files (such as images), but if you write non-ASCII text, you have to encode it yourself.
root can be either ‘local’ or ‘dropbox’. ‘local’ is the default.
-
RE: iPad multitasking support
The beta of Editorial has split-screen multitasking.
-
RE: Writing to a File with python in editorial
editor.get_file_contents(name[, root])
Return the contents of a file in the document library. root can be either ‘local’ or ‘dropbox’. The default is ‘local’.Note that this returns a plain byte string. If you want to get the text of a file that contains unicode, you have to decode it yourself (Editorial saves text files as UTF-8).
editor.set_file_contents(name, new_contents[, root])
Writes new data to the file with the given name (a relative path). If a file with this name exists, it is overwritten.Note that new_contents is a byte string, which means that you can also use this to write binary files (such as images), but if you write non-ASCII text, you have to encode it yourself.
root can be either ‘local’ or ‘dropbox’. ‘local’ is the default.
-
Help with script
Is this the best way to say output a list of say the 10 closest birthday? I think not. Thank
import contacts from datetime import datetime import operator import workflow import dialogs days_list = [] people = contacts.get_all_people() now = datetime.now() for p in people: b = p.birthday if b: next_birthday = datetime(now.year, b.month, b.day) if next_birthday < now: next_birthday = datetime(now.year + 1, b.month, b.day) days = (next_birthday - now).days days_list.append({'name': p.full_name, 'days': days}) if not days_list: print 'You don\'t have any birthdays in your address book.' else: days_list.sort(key=operator.itemgetter('days')) for item in days_list[:1]: text = '* %s in %i days' % (item['name'], item['days']) for item in days_list[:2]: text2 = '* %s in %i days' % (item['name'], item['days']) for item in days_list[:3]: text3 = '* %s in %i days' % (item['name'], item['days']) for item in days_list[:4]: text4 = '* %s in %i days' % (item['name'], item['days']) for item in days_list[:5]: text5 = '* %s in %i days' % (item['name'], item['days']) birthday_list = '\n'.join([text, text2, text3,text4,text5]) workflow.set_output(birthday_list)```
-
Help
What do I add to this script so it output each element (date,text, width and, length ) on a separate lines of the open file? '\n' ? Thanks.
import dialogs Dialog_List =[{'type':'date','title':'Date','key':'date'},{'type':'text','title':'description','key':'text'},{'type':'number','title':'Width','key':'wid'},{'type':'number','title':'Length','key':'len'},] Form_Dialogs = dialogs.form_dialog('Form Dialog',Dialog_List) date = Form_Dialogs['date'] text = Form_Dialogs['text'] width = Form_Dialogs['wid'] length = Form_Dialogs['len']
-
RE: Force reload in workflow
import time
# Wait for 5 seconds time.sleep(5)
This is what I use on the iPhone while its running I hit the Dropbox sync button manually. You can change the (5) to what ever you like. If you are on a iPad you can use the pause before running that is the custom action menu that is in ever action in a workflow.
-
Adding up measurements
I often make a list of measurements in feet and inch. Then have to pull my calculator to add them all up. Is there a way to build the workflow to do this for me?
Input:
5' 6"
3' 8"Output:
9' 2"Discussion started with RV: Forums New Discussion workflow
-
RE: Adding up measurements
Thank you for your time. How would you add that first code to this code?
import editor import re def main(): text = editor.get_selected_text() feet = sum(int(x) for x in re.findall(r"(\d+)'", text)) inches = sum(int(x) for x in re.findall(r'(\d+)"', text)) if not (feet or inches): return feet += (inches / 12) inches %= 12 replacement = '%i\' %i"' % (feet, inches) start, end = editor.get_selection() editor.replace_text(start, end, replacement) main()