File Read / Write (Variable improvements)
Closed this issue · 4 comments
It would be useful if i could map a variable value to a file content in booth directions (read is preferable).
eg.: read plain text file (contains some payload) into a variable before running shortcut.
This can be used to send some text (utf-8) data from android's file system to nodemcu or raspberry pi.
Write-back variables will be also useful.
eg.: we put http response into a variable that writes it into a file on sdcard.
So, can i suggest adding 2 types of variables: file-read and file-write. They would have value and absolute file path in their settings.
update: just found out that variable content size limited to a small ammount of characters :(
if this feature is too hard to implement, can u just let send a used-selectable text file as body payload?
This sounds like an interesting use-case. I have added it to my backlog. I can currently not make any estimates on when or if I will be able to add it.
As of version 1.32.0, it is possible to use a file as the request body. Just select the "File (Picker)" option when editing your shortcut's Request Body settings. When the shortcut is execute it will prompt you to pick a file. It is not possible to automatically always pick a pre-defined file, as that would require further access to the file system, which I'm reluctant to add as it is a potential security / privacy problem.
With version 2.0.0 (which will be released soon) it will also become possible to save the response back into a file. There will be a save button in the toolbar when using the "Window" response display type. It will not be possible to automatically store into a file, for the same reasons outline above.
Hope this helps. I'll keep this issue open as not everything in it is currently addressed.
As of version 2.31.0, there is a feature in the app that allows you to configure a shortcut so that it stores the HTTP response into a file of your choice. This should address part of this issue.
As of version 3.4.0 (which is being released now), it is possible to choose a specific file to use as the request body or as a form parameter. The same file (i.e., from the same path) is used every time the shortcut is executed, without opening a file picker.
With that, this feature request should now be fully covered, as it is now possible to read from and write to files.