@JonB .. your link to copy filesave never worked. i tried it a number of times. the code runs, the file is created but it's empty. perhaps the path is not correct or i need a github token or something?
that said, by manually pasting the filesave script, i was eventually able to get this to run and it works downloading the gist i specified above! i confess, it took me a number of iterations to try and assign the script to an "appex action" thing or whatever it's called so that it showed up from the share sheet extension automatically but somehow it eventually did.
your instructions were different from what i saw on my iphone.
the wrench only appears when editing a file. once you click the wrench, you have an Edit button that allows you to add a blank "icon" with a plus in it. from there you choose the file to assign to the icon which then shows up one you drill back to pythonista from the share sheet.
anyway : just so i'm clear. for the share sheet to work correctly, do these icons assigned to pythonista scripts need to exist (ie it's the glue that the share sheet looks for)? or put another way do pythonista scripts only recognize the appex data when called in this way? because before i could assign the icon to the filesave script, when i share sheeted from safari back to pythonista it dropped me in the editor. if i then navigated to savefile and ran it manually, it didn't appear to be able to access the appex data of the last page i was on in safari. my guess is the answer is yes.. savefile needs to be tied to the icon which is what you call the appex extension??
thanks for being patient and following this through. much appreciated. i got it working just want to make sure i'm understanding the right process for interfacing with appex data via share sheet
actually i just got this download script to work in pythonista console and successfully downloaded your zipfile. however it just doesn't work in the editorial console even with fresh pastes. it keeps telling me download_file is "name not defined". perhaps python version issues between the two apps?
i've had nothing but trouble downloading stuff.. the script i copied in to the console doesn't work in editorial for some reason.. no errors when i paste and enter the script. but the console can't even find the download_file function afterwards. it's showing as download_file not defined. i've spent so much time just trying to get basic things working in these apps. it's frustrating. i confess i don't usually use the console. i'm used to writing python scripts in files and running the files so this is a bit new to me. i wish i had an ipad. trying to do all of this on a small iphone is tiring. any thoughts on what i might be doing wrong? i've copied this script verbatim..
one last question for tomorrow.. you said:
- Download the filenav source code as a zip from GitHub and import it into Editorial
i'm still in the process of figuring out how to download things to pythonista via a variety of methods. but i've never downloaded anything into editorial yet. so is there an existing workflow in editorial to import and or download the zipfile directly or via pythonista. or some quick code i can cut and paste in a workflow to get the code base local to editorial. sorry for not knowing how to do that.
awesome. i'll give this a look tomorrow. thx!
note that even if it cuts the names off, based on when i ran your old filenav script in editorial earlier, the font is much smaller (and my guess is i can configure that), so that i see enough of the filename to give me the context i need vs the stock editorial file browser..
it sounds like you're focus is more on pythonista but do you know if the custom ui modules works the same in both editorial and pythonista? i get the feeling they may be identical which means pure ui interface code should work well in editorial if borrowed from pythonista and vice versa. your filenav would seem to bear that out.
finally, i found an editorial workflow in the online directory that almost gives me everything i want (though much less functionality than your filenav as it only allows listing one directory with no directory walk down to child dirs). it uses a ui tableview to select the filename from dropbox (this works!) but it doesn't actually set the row text as workflow output variable which means workflow input is empty in the next step which tries to open a blank filename? i don't see anything in the documentation that explains if / how tableview selections are supposed to trigger setting a default workflow output var for the next step. but the ole the guy who wrote this apparently thought it would work as is. i posted specific details in the editorial forum (summarized pretty well here though)
do you know the best way to get the selected row from a tableview out and to the next workflow step in editorial or why it's not being set by default?
thx as usual!
i'm trying to use a workflow that lists files in a given directory (that you specify in the workflow before you run it)
i can actually get the workflow to list files in my specified dropbox directory in a custom tableview! which is great! that's the hard part.
when i select the file, the tableview doesn't do anything.. it just sits there waiting. however there is a " Continue" Button right up at the top of the view, so i hit that and it appears this triggers the next step, which is a python block to open the file, in the workflow. (fyi, nothing i can find in the ui documentation tells me anything about the Continue Button or default tableview behavior but based on what i'm seeing it is indeed going to the next step in the workflow)
the problem is that what is being selected in the tableview is NOT being passed by default to the workflow input function of the next python block! as a result the directory full path to open the file is correct but the basename of the file is missing and thus editorial can't open the file since the filepath is incorrect.
the question i have is :
how do i get the value selected in a tableview row to automatically set and be the workflow input of the next step? i assumed this was the default behavior but if it's not how do i explicitly set an appropriate var so it can be passed to the next step and more importantly where do i do it in the UI editor? i dont' see any mention of how this is handled in the custom ui documentation but it's crucial to using any custom ui element.
@JonB sorry but unfortunately your install link for filesave is failing for some reason.. error is something about
AttributeError __enter__followed by
.exec_from_url.py <module> (Line 13)
not sure what's going on.
also from your last reply "click back a few times untill you get to the main appex page. should have edit in upper left, and some icons below. you wNt to add savefile to the bottom icons." doesn't really look the same to me as you describe. maybe because i'm on an iphone7 vs ipad?
i'm not sure what the main "appex" page means unless that was spellchecked for " index" :), once there, i see "Edit" button but it's in top right vs left.. The icons below are simply my normal pythonista file browser listing with icons for folders and files with their appropriate names. python actualy opens the file filesave.py into this location but because of the script failure nothing actually gets written so that when you open it to run it, it's empty..
i'm wondering how to specify my dropbox folder (what is the path) using python in editorial so that i can get a list of files in that folder?
also is the ui module in editorial and pythonista the same? ie if i borrow ui code from pythonista community which is more active than editorial will it work in editorial? from what i can tell they're identical.
finally, it looks like editorial comes with a useful list of python modules to use but if for some reason i want to pip install something else not already included, is it possible and if so how?
@JonB .. ok just to confirm..
- i'm on the gist page..
- this time i do NOT try and copy the url i simply click Share button in safari
- then i click " Edit Scripts" which brings me to pythonista
- in pythonista i don't have a + option like you mention but i see my filesave.py file right in my local directory listing in the file browser (probably b/c that's where i last was in pythonista) so i simply select the file which loads it into the editor
- the script is just sitting there in the editor and does nothing on it's own so i click the "right arrow symbol" to run the program..
when i do that i get this error in the console:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/50D9A78C-3AC4-470C-908E-FB2D1012D385/Pythonista3/Documents/gitsavefile.py", line 9, in <module> urlfilename=unquote(unquote(urlparse(appex.get_url()).path.split('/')[-1])) TypeError: a bytes-like object is required, not 'str'
so it looks like it's expecting bytes and not a string?
thanks for the clarification on how the script was supposed to work?
@JonB thx for followup.. i'm not sure i'm following the link you posted in the bottom of your reply. i would think i have no control over what the share sheet is sending to savefile.py.. so how do you know what is being set in the call back url from the share sheet in the first place? i'm curious because maybe that's part of the problem of why it's not working?
i thought that regardless of whether i ran from the share sheet in the form of an x-callback or simply copied the url in safari and run the script manually when i switch back to pythonista with url in the clipboard, that the only argument to this script is the url of the gist? but it looks like a bunch more things are being populated in the link you pasted.
also, perhaps i'm copying the wrong url?
this is the link i'm highligting and copying before running the script?
by default what directory will savefile put the downloaded gist?
fwiw, after spending a couple of days trying to get all this to work it would have been easier but not simple to just copy and paste the gist code in safari directly into a new pythonista file except for the fact that for some reason that "select all" is not allowed in safari gist text on my iphone7 which means i have to tediously drag to try and select everything past 1+ scrolls which often fails before i can actually copy!??
thx for the help!