본문 바로가기

App Inventor

Screen을 복사해서 사용하기

Sometimes you have an app that has more than one screen with basically the same programming in each one. Instead of programming each screen separately I have a way to copy one screen and paste to all other screens. For instance, I have an app that locates restaurants for American Food, Mexican, Italian....etc. I programmed the first screen (American) and copied it and pasted on all the other screens and just changed a few minor details like About Screen and the Google commands in the blocks as well as the Title. Saves a lot of time!

프로젝트 안에서 스크린 복사 방법(예: ScreenA -> ScreenB로 복사)

1. App Inventor에서 ScreenB를 만든다(빈 Screen)
2. 프로젝트를 aia 파일로 컴퓨터로 Export 한다
3. 7zip 이 설치되어야 한다(왜냐하면 압축된 상태에서 파일을 수정할 수 있기 때문)
4. aia 파일을 오른쪽 마우스 클릭하고 7zip으로 오픈한다
5. scr 폴더 아래에서 blk, scm 파일들이 있는 폴더까지 이동한다
6. ScreenA.blk를 열어서 내용을 복사한다
7. ScreenB.blk를 열어서 A에서 복사한 내용을 복사해 넣는다. 저장한다.
8. ScreenA.scm을 열어서 내용을 복사한다
9. ScreenB.scm을 열어서 A에서 복사한 내용을 복사해 넣는다. 
10. ScreenB.scm 파일의 앞부분에 {"$Name":"ScreenA" 부분을 찾아서 {"$Name":"ScreenB" 로 바꾸고 저장한다.
11. aia 파일의 이름을 바꾸고 App Inventor에서 Import 한다

Here's how:

1. Make sure you have the screens made by Adding Screens...for instance I made a blank screen for Mexican, Italian...etc.
2. Export aia to your computer
3. You must have 7zip installed on your computer for this to work. All copying must be inside 7zip to work. Download at http://www.7-zip.org/
4. Right click aia file and open archive with 7zip.
5. Click on src folder and open all until you see your pages with blk, scm, and yail.
6. Go to the blk file of the screen you want to copy. ex. American
7. Go to View
8. Notepad will open with xml file. Select All and Copy. Close notepad.
9. Go to next blk file you want to copy into ex. Mexican
10. Right click and view. Select All and Paste. Save. Close notepad. It will ask if you want to update, press ok.
11. Rinse and repeat for all files you want to copy into.
12. Next, go to scm file you wish to copy from. ex American.scm
13. Right click and view. Select All, Copy, Close notepad.
14. Go to file you wish to copy into. ex Mexican.scm
15. Select All and Paste.
16. Find where it says {"$Name":"Name Of Your Screen Name" ex. {"$Name":"American"
17. Change the screen name to the name of the screen you are pasting into. ex {"$Name":"Mexican"
18. Save, close notepad, and ok to update.
19. Rinse and repeat for all other scm screens. (except for the screens you don't want changed of course.)
20. Close 7zip window and go to where your file is located on your computer and right click and Rename.
21. Upload your aia file back onto app inventor.

The yail files do not need to be altered.

You are all set. Just change the information that needs to be changed on each page to suit the category!

https://groups.google.com/forum/#!category-topic/mitappinventortest/E2pUu8KkXQ4 


'App Inventor' 카테고리의 다른 글

Longest, A GPS Distance Checker(GPS 거리측정기)  (1) 2017.01.30