cajujoe
I hate code!
Profile
Posts: 24
Reg: Nov 15, 2011
Rio de Janeiro
4,090
11/16/12 10:22 AM (13 years ago)

Fast way to create screens

Hello friends, I´m updating a periodic table app that I created with xcode in 2010, and I want to use buzztouch. But there are more than 100 chemical elements. In xcode I used a variable system that loaded different info in the same screen. Now I want to put one pdf for each element, with a navbar right button to link to the wipedia. The only way is to create 200 screens? (For the elements pdfs and the custom urls). If this is the only way, there is a plugin to add screens fast in the control panel? I accept suggestions. Thanks!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
11/16/12 10:36 AM (13 years ago)
There may be a better workaround than this, but there's at least 2 ways of creating screens quickly: 1) Use the JSON Snippet Keeper plugin. You can create one screen, then copy and paste it however many times you need, and go back and change the pdf filename on each one. I did this on my "The Text This Week" app where I had dozens and dozens of menu items, each going to a custom-url screen. 2) If you have a webserver that supports php, you could do this programatically and host the config.txt file on your server. You'd lose access to the BT control panel, of course. But if you're not planning on making many changes to the design of the app and need a way to quickly add new pdf files, this might make sense. Chris https://www.churchphoneapps.com
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/16/12 10:41 AM (13 years ago)
You could also look at the List Menu Tool, which can create a list menu config text for many document (PDF in your case) screens from a spreadsheet. You'd just have to add the navbar right button JSON to the final output. http://idevdepot.com/list-menu-tool/ But the JSON Snippet Keeper is also a great option. Both are my products, so feel free to ask any questions.
 
cajujoe
I hate code!
Profile
Posts: 24
Reg: Nov 15, 2011
Rio de Janeiro
4,090
like
11/16/12 10:48 AM (13 years ago)
Thanks Chris and Stobe. Stobe, I just send a message to you about the List Menu Tool, that I purchased before I put this message. It´s about creating a name in the navbar. I think I´ll buy the JSON Snippet Keeper too and see what works best. Maybe in the JSON Snippet I could change the url of the right navbar button easily. My fear is that the screens do not appear in the control panel, and I´m not a JSON programmer. Thanks!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
11/16/12 10:50 AM (13 years ago)
JSON really isn't hard to learn - especially how it's used for Buzztouch. The hardest things is just making sure you get all the commas in! :)
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/16/12 11:36 AM (13 years ago)
@cajujoe: Here's the instructions I promised. Hope they make sense! Assuming you used the List Menu Tool to create a ton of list menu entries for all your chemical elements, each entry leading to a PDF screen, you would now need to add the JSON for the right navbar button, which leads to your custom URL screens. (right?) First, lets create the 100 custom URL screens using the JSON Snippet Keeper plugin..... 1. Create a JSON Snippet Keeper in your control panel, and name it "URL Screens" (or something you'll remember) 2. Since that JSON Snippet will never be linked to a menu, you can start by deleting the itemID default text in the box. 3. We can create 100 screens in a single snippet, but not without a little bit of text editing. But it will certainly be faster than creating all the screens in the control panel. 4. Using a text editor (I use Text Wrangler for this, you can use any) copy and paste the following text, which should create one of your CustomURL screens.... {"itemId":"50001", "itemType":"BT_screen_customURL", "itemNickname":"hydrogen", "navBarTitleText":"Hydrogen", "dataURL":"http://en.wikipedia.org/wiki/Hydrogen", "forceRefresh":"1"} Note: the itemID number is just a manually created number, which should not interfere with any of your other screens. Same with the itemNickname, you could use the same for both to make it easier when it comes to text editing. Actually, the way buzztouch looks to load a screen, it looks for a match for either, so you might be able to leave out the itemNickname. I usually leave it just in case. 5. After you paste that item in your text editor, you can paste it in there another 99 times. Then just increment the itemId for each (50002, 50003, etc). And change the nickname, navBarTitleText, and URL for each screen, appropriately. Hint: If you can make your text editor wide enough to get the whole thing on a single line, it makes editing much faster by using the arrow keys. 6. When you have all 100 screens created in the text editor, copy and paste the whole thing into the JSON snippet - and hit save. Save the text file also, for editing later if needed (in case they discover another element, lol). Now your Custom URL screens are all created. The control panel doesn't "know" they exist, but it doesn't matter. The list menu screen will find them when they are needed. Now we need to edit the output of the List Menu Tool to make it load the URLs from a right navbar button. The List Menu Tool (Document List option) was designed to v1.5 apps, so it creates a different screen type for PDF screens. We need to fix this also, but it actually helps us for what we need to do. Look at this example, which should look similar to your output from the List Menu Tool: {"itemId":"11111113", "itemType":"BT_menuItem", "loadScreenObject":{"itemNickname":"Sample PDF", "itemId":"21111113", "itemType":"BT_screen_webView", "controlPanelItemCode":"menuList", "localFileName":"sample.pdf"}, "titleText":"Sample PDF"} (you will have 100 of these in your text file, if it worked out correctly) From that example, we need to change the itemType, AND add the right navbar button. We'll do this with some find/replace magic. 1. Open your text file (outputted from List Menu Tool) in your favorite text editor. 2. Do a Find Replace with these text strings: Find: "itemType":"BT_screen_webView" Replace: "itemType":"BT_screen_pdfDoc", "navBarRightButtonType":"infoLight", "navBarRightButtonTapLoadScreenNickname":"hydrogen", "navBarRightButtonTapLoadScreenItemId":"50001" This should fix the JSON for v2.0 (pdfDoc vs webView). And it will give you the JSON needed to connect to your customURL screens. Note: there are other options for the "navBarRightButtonType", look up those options in most plugins 2. If you did a Find/Replace (all), then you should have 100 screens in your text file edited - and all looking for the same URL screen. 3. While still in your text editor, you'll need to step through the 100 entries, and fix the "navBarRightButtonTapLoadScreenItemId" and Nickname for each entry (50001, 50002, etc). 4. When you're done, save this file, and it should work for your List Menu (menu simple in2.0) 5. You'll need to host this file somewhere (I use dropbox) or hack the Menu Simple plugin to load this file in your build (I've done it, but if you can host on dropbox, that's easier, lol). 6. If you host the text file on dropbox, make sure its in a public folder, and get the Public URL from dropbox. 7. Use that public URL as the "Screen Data URL" in your Menu Simple page. 8. Done! 9. Disclamer: the methods described above work perfectly inside my head. I did not actually try this. Results may very :) Good luck!
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/16/12 11:36 AM (13 years ago)
(that's got to be a record length post!)
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
11/16/12 11:42 AM (13 years ago)
I was just about to say that Stobe, talk about support! David https://buzztouchmods.com
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/16/12 11:48 AM (13 years ago)
Its actually really rewarding to see how someone's requirement can utilize and benefit from two of my "babies".
 
cajujoe
I hate code!
Profile
Posts: 24
Reg: Nov 15, 2011
Rio de Janeiro
4,090
like
11/16/12 11:57 AM (13 years ago)
Many thanks Stobe! I don´t have enough words to thank you. Now it´s time to work. As soon as a finish the app, I´ll let you know and I´ll put the app on the published section. You and the other members are the reason to love and use buzztouch.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.