This technique of copying screens in an AI2 project uses Windows Explorer to add new screens to an AI2 project.
When copying screens manually, be careful not to use keywords such as 'Button' for your new screen names as 'button' is one of the words used in component definitions in the screen files. Manually copying a screen named 'Button' will cause any button definitions to be corrupted by replacing 'button' with the new screen name and the new screen will not work. I add an SCR suffix to my screen names to insure that this does not happen. Alternatively you could make sure that you avoid those keywords.
Also, when copying screens from one project to another, be sure to also copy any assets needed by those screens from the source project to the destination project.
Screen CanvasSCR will be copied and named ClockSCR. I captured the screens for each step of the process below:
Export your project to a folder on your computer.
Then place a copy of it with the original name in another folder for adding the new screen to.
Replace the aia extension on the copy's project name with a zip extension:
Open the project with Windows Explorer:
Navigate to the folder containing the screen files:
Drag the files with the screen name to be copied out of the archive:
Edit each file:
Replace all instances of the old screen name with the new screen name:
...then save each file.
Rename the Screen files to the new screen name:
Drag a copy of the the renamed screens to the archive:
Change the project extension back to aia:
When you import the project into AI2 it will contain the new screen. If you have an <old screen name>.Initialize block in the original screen it will now be named <new screen name>.Initialize in the copied screen.
END
--
I tried similar steps as explained below for creating duplicate screen. But while upload I am getting below error
I tried similar steps as explained below for creating duplicate screen. But while upload I am getting below error
"The selected project is not a project source file! Project source files are aia files. "
But I renamed the zip file back to .aia
Could you please help on this
--
Email me a good copy of the project with instructions on what you want done and I will do it for you.
You can also try the 7zip method.
--
7zip is free software.
--
When I Rename the files back to .aia it stays as a .zip file causing it to not be able to be imported into App Inventor. How do you change the file back to a .aia file?
--
--
Make sure you followed the steps exactly as said.
Important :
1. create two copies of the aia project. Say xyz.aia and xyz_copy.aia.
2. rename both files to .zip. ==> xyz.zip and xyz_copy.zip
3. unzip xyz_copy.zip file. create copy of the screen as explained above.
4. move the newly created ( copied and then renamed ) screens from xyz_copy folder to xyz.zip
move here is drag from copy folder to zip file using windows explorer
5. rename xyz.zip to xyz.aia
upload this file
--
Thanks for that explanation, vasista :)
--
Also, I have a method that uses a third-party utility called 7zip.
It makes the process a bit easier - you don't have to rename your aia to zip then back to aia with that.
It works directly with the aia archive and recognizes it as such.
That is the method that I use.
I made the Windows Explorer method so users would not have to install 3rd-party sofware, but 7zip is safe to use.
--
Is there a way to do this from a mac?
--
Good question!
I will post this question in the MIT forum as I would like to know the answer also: https://groups.google.com/forum/#!forum/mitappinventortest
--
--
Is there any way to do this with the new version of App Inventor (nls-251-gc1bdb77) and the new .apk files?
When I open up the file "appname.zip", I only get a meta-inf, res, manifest, and classes.dex, all of which either lead to unhelpful things or I can't open.
--
--
you only can copy screens for project files (zip for App Inventor Classic or aia for App Inventor 2), not apk files!
--
--
Thanks seems so obvious now *facepalm*
--
Hi, I just tried this method in AI2, but it doesn't seem to work right. The new page is there, but if I attempt to click on any of the components, I get an internal message error. I was wondering if you knew what I might be doing wrong.
--
--
This method works with aia project files only.
--
--
I followed the steps for your method, but in the end I couldn't convert the zip file back into a usable aia. Whenever I try to change the extension it changes the name to having .aia at the end, but it is still a .zip folder that I cannot upload. Any ideas?
--
--
Work directly with the archive -- in other words you open it but -- do not do an extract. That messes things up.
--
I am hoping that is the problem, if not, I don't know what else to suggest.
--
That, exactly, is the problem. See here: AI Screen Manipulation
--
Nice tutorial. I need to start referring users there :)
--
--
Thanks Scott
--
That didn't seem to change anything. Also, I can drag the new files in to the zip folder, but from there I can't get them to the right place in the SRC folder.
That didn't seem to change anything. Also, I can drag the new files in to the zip folder, but from there I can't get them to the right place in the SRC folder.
--
why don't you navigate to the correct folder first before dragging the new file?That didn't seem to change anything. Also, I can drag the new files in to the zip folder, but from there I can't get them to the right place in the SRC folder.
example screenshot of project basket.aia
--
That helped, but I still can't convert the zip back into an aia by renaming it, even if I don't extract the files from it
--
are you saying, you are not able to rename a file?
--
btw. in the example above I opened the aia file using 7zip without renaming into zip!
--
I can rename 'file'.aia into 'file'.zip as a zip folder, but when i try to rename that back into 'file'.aia I get 'file.zip'.zip as a zip folder.
Trying out the 7zip method gets more tempting as this continues to not work--
That solved my problem, everything works now. Thank you very much for the help
--
Nice catch.
--
--
Can confirm this works using linux with built in archive utilities, Leafpad and Thunar
What other edits are necessary to copy only blocks/components into an existing screen. I have many situations where I have a discreet set of code, blocks and components to perform a function in a project. So this all lives in Screen 1 of the source project and I want it in Screen 1 of the target project. Generally the source code will not impact on the target pre-existing code? ( I tend to use the old school method for multiple views, as opposed to multiple screens ;) )
--
I would recommend making multiple copies of the project that has Screen1 with the source code. Leave one untouched and build the apps that need the code from the copies. If you have already written code for the app and need to add the source code, that would be more complicated to do automatically, and you may have to add it manually.
--
Thanks for letting us know--
I don't have Linux or Mac so could not test on those.
As a follow up to your question, you can ony copy a whole screen.
That is not to say someone cannot figure out a way to add xml text representing blocks in the .bky files but they seem to contain serialized id tags that I would not know how to generate.
--
You probably have file name extensions hidden. Since "aia" is not a recognized extension, it shows up. When you change it to "zip", it disappears. Then when you change it back to "aia", it reappears, but "zip" is still there, hidden. So the file extension is really "zip" even though what you see is "aia". Get it?
I tried this technique with an AI2 project. It worked fine, except that, in the AI2 Designer, in the copied screen, the image (a .png asset) does not display on the canvas in the new, copied screen. It displays fine in AI Companion on the device. It also displays fine on the original screen (Screen1) in the AI2 Designer. Both screens list the image file in the Designer and in the canvas backgroundimage property.
Using the technique in this thread, I took the tutorial project "PaintPot", and copied "Screen1" to a new screen "Meow_scr". I discovered this problem when I imported the new project into the AI2 online development environment.
To test it on the device, I added a "Go to Meow_scr" button to Screen1. It works perfectly on the device. The cat image displays on both screens, "Screen1" and "Meow_scr" (which is an identical copy of Screen1 with all occurrences of "Screen1" having been changed to "Meow_scr" and filenames changed to the new screen name).
I also tried using a different image file in the canvas on Meow_scr. That did not help the situation.
The bottom line is that this technique appears to work fine in AI2, but there is a quirk in how it displays in the Designer.
Any suggestions or explanations?
--
Using the technique in this thread, I took the tutorial project "PaintPot", and copied "Screen1" to a new screen "Meow_scr". I discovered this problem when I imported the new project into the AI2 online development environment.
To test it on the device, I added a "Go to Meow_scr" button to Screen1. It works perfectly on the device. The cat image displays on both screens, "Screen1" and "Meow_scr" (which is an identical copy of Screen1 with all occurrences of "Screen1" having been changed to "Meow_scr" and filenames changed to the new screen name).
I also tried using a different image file in the canvas on Meow_scr. That did not help the situation.
The bottom line is that this technique appears to work fine in AI2, but there is a quirk in how it displays in the Designer.
Any suggestions or explanations?
--
My only thought is to be sure to copy your assets if copying from one project to another.
Assets already contained in a project where the screens are being copied/added should be available automatically to the copied/new screens.
--
don't forget to change the name of the screen in Screen1.scm. e.g.
--
don't forget to change the name of the screen in Screen1.scm. e.g.
#|
$JSON
{"YaVersion":"140","Source":"Form","Properties":{"$Name":"Screen1","$Type":"Form","$Version":"18","AppName":"FileByFile_copy","Icon":"icon.png","Title":"Webprefetch File by File","Uuid":"0","$Components":[{"$Name":"Label1","$Type":"Label","$Version":"3","HasMargins":"False","Height":"-2","Uuid":"1990261919"},{"$Name":"varDownload","$Type":"VerticalArrangement",
etc.
--
That is correct if you are replacing Screen1.scm's text with <another name>.scm's text since the first screen must always be named 'Screen1'.
--
I created an application that will Copy and also Rename screens very easily. See screens below and Link beyond that.
--
Looks great.
When I run the executable on Windows 10, I get a blank dialog and it goes no further:
It passed my Avast antivirus scan and Windows allowed me to run it, but not without warning.
So users may have to tell it to 'run anyway'.
--
I looked in the github link, and did not see any source code.
I looked in the github link, and did not see any source code.
Am I missing something here?
--
It was done with Auto-It 3, Abraham.
He just included the executable, I think.
But he is working on a bug fix which includes the missing image files this afternoon.
--
--
블로그 관리자가 댓글을 삭제했습니다.
답글삭제