I am just a beginner, I created this widget from scratch by watching from tutorials from here and there. Now I want that a random quote is shown at that place everyday, from my txt file. I have seen many reddit post but it didn’t help because I am unable to locate the txt file into custom folder. It always throws some error like “can’t read file”, then I put it Into the Kustom folder and then it says something like “Can’t identify if primary or children”. Where should I create my custom folder, in downloads or android or just on the emulated/0. How to put the file into the Kustom folder. What is the code to perform the function. Please help.
so i believe you want to get quotes randomly from text file saved on phone? because getting it from reddit rss would probably be easier than reading it randomly from text file. if you want to ask if where to save file then i believe most suitable location would be in your kustom folder which you should have created at the first time you opened kustom app or if you skip over that then you can still set it in settings in.
or here is free api that returns motivated quotes in json format use $wg("http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=json", json, .quoteText)$
besure to credit to
api by forismatic
for their Api.
or if you want to use different field in that response open that URL in browser and you’ll see Json response with their key-value pair. let me know if you have any other questions or need help.
also, if you want to use quotes from local file then place it inside kustom folder and then get text by $wg("file:///sdcard/test.txt", raw)$
where you replace file location address path in first quotes of "file:///sdcard/test.txt"
that was example of kustom formulas in default examples however location differs such as take a look at picture below
which I got by running flow and pick latest file in folder so you might probably want to create new folder where you only keep that only file in this case instead of kustom folder so when you first time run flow it picks latest file and keep that flow to manual or cron or on load but result is going to be same since there is only one file in this folder however it also gives error. so, it’s better to use rss than local file, I still am exploring on use of local file however if you put text file to your kustom folder then you can use following syntax kfile://org.kustom.provider/textFile.txt
which you can put in the wg function to read file. hope this helps