Movicon Help on Line - Rel. 11.7.1301
Movicon has a feature that consents to the automatic refresh of all references to resources when they are renamed. The resources concerned are:
Screens
Basic Scripts
Menùs
Shortcuts
When you rename a resource, you will not need to replace the old name with the new one in all the various parts of the project it is used.
The automatic resource name replacement mechanism only works if the project's execution "Enable Renaming Manager" property is enabled. If not, the aliasing mechanism, described below, will not be used and old names of any renamed resources will have to be replaced manually in the project. |
Movicon uses an"aliasing" mechanism which keeps trace of the resource's original name and its new one. When the resource is remained may times, only its original name and the last name will be traced. This information, the relationship between the resource's original name and its new one, is kept in the ".movprj" file. The tags which enclose this information are different for each resource and they are: <RenamedScreens> for Screens, <RenamedScripts> for Basic Scripts, <RenamedMenus> for Menus and <RenamedAccelerators> for Shortcuts.
... <RenamedScreens> <item key="Screen4" value="Main"/> </RenamedScreens>
<RenamedScripts> <item key="Basic Script1" value="Basic Script2"/> </RenamedScripts>
<RenamedMenus> <item key="Menu1" value="Main"/> </RenamedMenus>
<RenamedAccelerators> <item key="Shortcut1" value="Exit"/> </RenamedAccelerators> ... |
Where:
item key: represents the resource's original name
value: represents the last name used for renaming the resource
When the Renaming Manager has been enabled, it is advised to re-use original resource names for creating new resources. This kind of operation is always controlled by Movicon with the following warning message:
Warning! The resource name 'Screen1' has been renamed to 'Screen2' in this project. Do you want to use this resource name? Answering 'Yes' will remove the recorded renamed link.
The above message was generated because the user, in this case, had been trying to create or rename a screen with the name of 'Screen1' which had been already used as an original name before being changed to "Screen2". At this point, answering with 'Yes', will delete the alias link and annul the automatic aliasing mechanism for this screen. For instance, if you associate the VAR00001 to a display object and then rename it with VAR00002, the display will result associated to VAR00002. In addition, only one variable, the VAR00002, will be present in the RealTimeDB. However, if you insert a new variable with the name of VAR00001 in the database and confirm the use of this name, the alias link will be deleted and the display will result associated to VAR00001 again but which however is the new variable. In this case both the VAR00001 and VAR00002 will result as being in the RealTimeDB as two separate variables.
Lets use another example, if you associate a command to open Screen1 to a button object and then rename Screen1 to Screen2, the button will result associated to the command to open Screen2. In addition to this, only one screen, screen2, will be present in the Project Explorer window. However, if you then insert a new screen in the name of Screen1, and confirm its use, the alias link will be deleted and the button will result associated again to the open command of Screen1, which is the new screen. In this case both Screen1 and Screen2 will be present in the project and will result as being two separate screens.
When inserting a new resource, Movicon will propose a name which has not been used or not in use in the project and has not been used as an original name for a renamed resource. For example, if you insert 'Screen1' which you then rename as 'Screen2', Movicon will propose 'Screen3' as the name of the next new screen you create afterwards.
WARNING! the "aliasing" mechanism can be deleted by deleting the xml tags which show the list of renamed resources from the ".movprj" file. By doing this, those resources which were renamed will retain the last name they were associated with, while the references inserted in commands will keep the links to the resources' original names and may no longer be valid. |
Automatic replacing of renamed resources is performed in different ways according to the object or the resource in question, as described below:
Screen Resources:
Startup Screen Execution Properties: the new screen name will automatically appear in the project's "Startup Screen" properties
Command List Screen Command: the new screen name will automatically appear in the command's "Screen" property
Basic Script: the original screen name will always appear in the basic script code for all functions which have a screen name as a parameter, but the code will be executed in relation to the new screen name
Basic Script Resource:
Start/Stop Script Execution Property: the new basic script name will automatically appear in the project's "Start Script" and "Stop Script"
Command List Script Commands: the new name of the basic script will automatically appear in the command's "Script" property
Basic Script: the original name of the basic script will always appear in the basic script code for all functions which have a script name as parameter, but the code will be executed in relation to the new basic script name
Menù Resource:
Command list Menu command: the new name of the menu will automatically appear in the command's "Menu" property
Basic Script: the original menu name will always show in the basic script code for all functions with a menu name parameter, but the code will be executed in relation to the new menu
Matching names such as "screen name - menu name" or "screen name - accelerator name" will not benefit from the automatic name replacement. This is because, if you change the name of the screen, you will also need to change the name of the menu or accelerator to keep them associated to that screen. For example, lets suppose you need to define a "LayOut" screen, a "LayOut" menu and a "LayOut" accelerator in a way that when the screen is loaded, the menu and accelerator with matching names are also activated. Then after having done this, you rename the screen to "PlantLayOut", you will also need to rename the corresponding menu and accelerator with this new name to keep them associated. This also applies to other menus or accelerators associated to the Startup Screen and used for default by all those screens which have not got their own. Also in this case, menus and accelerators must be renamed with the same name as that of the Startup Screen.
Applying Renamed Resources Permanently
You can apply the new names of renamed resources permanently (screens, basic scripts, menu and shortcuts) by using the "Apply Renamed Variables and Resources" command from the "Edit" and "View" menus or by using the "Apply New Name" command from the resources' context menus. When doing this, a search will be carried out in all the project's resources and objects to replace all the old name with the new one and the rename variable will be delected from the ".movprj" file. However, by doing this, the Aliasing mechanismn will be eliminated for this resource.
A request to activate this command will also appear when the option for renaming variables and resources management has been disabled.
This command also replaces the names of resources used within basic script code of objects or basic script resources (except for the shortcut resources which do not have basic script commands).
Comments are also inserted in the code to indicate where the replacement was made:
''Menù1' Menu replaced with new 'Menù2' name'
''Screen1' Screen replaced with new 'Screen2' name
'Script2' Basic Script replaced with new 'Script3' name
Criteria for Replacing the Resources in Basic Script Code
When activating the command to apply the new names of resources and the parser finds text in the basic script code that corresponds to the name of the renamed resource, it will replace this text with the resource's new name by followng the below criteria only:
a search will be carried out for any specific Movicion DOM command which may have been used to manage these resources with code such as: executecommand, showmenu, openscript, startupscript, shutdownscript, unloadscript, runscript, openscreen, opensynopticparameter, opensynopticex, openmodalsynoptic, opensynoptic, startupscreen, getsynopticinterface. When found, the replacement will be done in the parameter indicating the screen name.
only the texts in between the double inverted marks are replaced.