原文信息

系统需求:

  • Microsoft Windows 2000/XP
  • Microsoft .Net Framework 1.1/更高
  • MDAC 2.7/更高
  • MyGeneration

概观

这是一个使用 MyGeneration 开发模板的基本的介绍。如果你安装了 MyGeneration ,并且对 MyGeneration 感到迷惑的话,这里是一个很好的教你使用 MyGeneration 的教程。这个教程将教会你使用 MyGeneration 创建基本的 JScript 或 VBScript 的模板。

创建模板

    • 打开 MyGeneration
    • 从菜单中选择File->New->JScript Template或者File->New->VBScript Template 
      填充模板属性
    • 你可以通过点击 Property 按钮查看或编辑模板的属性 
      按照如下的显示填充属性窗体

保存模板

  • 选择File->Save As...保存模板

输入UI接口代码

通过切换到Interface Code的Tab页面,可以编辑接口代码。这里的接口代码在运行时,将会生成一个窗体,提示用户输入一个名称,而用户输入的名称将会替换掉“Hello World”中的World。

JScript

 //In the interface code segment, the setup function
//is the initial function call.
function setup()
{
//Set the form title bar to say "Hello World!!"
ui.Title = "Hello World!!"; //Set the height and width of the form in pixels
ui.Height = 150;
ui.Width = 340; //Add a label and a textbox to the form.
ui.AddLabel("lblName", "Enter a Name:", "Enter a name below");
ui.AddTextBox("txtName", "World", "Enter a name in here"); //The number of times to repeat "Hellow World!!"
input.item("timesToRepeat") = 10; //Tells MyGeneration to display the form. If this is
//set to false. MyGeneration skips displaying the
//form, but retains any changes made in the interface
//code segment.
ui.ShowGUI = true;
}

VBScript

 'In the interface code segment, the setup function
'is the initial function call.
Sub setup()
'Set the form title bar to say "Hello World!!"
ui.Title = "Hello World!!" 'Set the height and width of the form in pixels
ui.Height =
ui.Width = 'Add a label and a textbox to the form.
ui.AddLabel "lblName", "Enter a Name:", "Enter a name below"
ui.AddTextBox "txtName", "World", "Enter a name in here" 'The number of times to repeat "Hellow World!!"
input.item("timesToRepeat") =
'Tells MyGeneration to display the form. If this is
'set to false. MyGeneration skips displaying the
'form, but retains any changes made in the interface
'code segment.
ui.ShowGUI = true
End Sub

测试UI接口

如果你想测试一下前面输入的内容的结果,你就需要执行模板。点击工具栏的Execute按钮(绿色的播放按钮),你将看到如下的结果

输入模板代码

通过切换到Template Code Tab页,可以查看和编辑模板代码。如下的代码将生成一个显示10各Hello Name!!!的HTML页面。

JScript

 <html>
<body>
<% for (var i = 0; i < input.item("timesToRepeat"); i++) { %>
<br>Hello <%= input.item("txtName") %>!!
<% } %>
</body>
</html>

VBScript

 <html>
<body>
<% For i = to input.item("timesToRepeat") %>
<br>Hello <%= input.item("txtName") %>!!
<% Next %>
</body>
</html>

执行完成的模板

  • 执行模板之前,保存模板
  • 点击执行按钮,执行后的结果如下:
  <html>
<body>
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
<br>Hello World!!
</body>
</html>

结束语

希望通过这个教程,你看到了 MyGeneration 通过你的指尖在键盘上的敲打而显现的强大的力量。当你开始熟悉 MyGeneration 之后,我建议你做如下的事情:

    1. 查看安装 MyGeneration 时附带的模板,我从哪儿学到了很多;
    2. 研究 Zeus 的API文档以及 MyMeta ;
    3. 思考一下,在你的工作中哪些需要使用 MyGeneration ,发现这些,你将会吃惊的发现,以前很多耗时的工作, MyGeneration 会使它们变得轻而易举。

使用MyGeneration创建模板:介绍(翻译)的更多相关文章

  1. Aurelia 创建模板

    今天介绍一下Aurelia创建模板的三种方式. 模板既可以作为页面也可以作为组件. 1. View+View Model Aurelia的模板通常由一个html文件和一个同名的ts或js文件组成,文件 ...

  2. Sitecore CMS中创建模板

    如何在Sitecore CMS中创建模板. 在/sitecore/templates选择应创建模板的文件夹中. 注意:在多站点项目中,通常会在模板所属的网站名称的/sitecore/templates ...

  3. Django项目的创建与介绍.应用的创建与介绍.启动项目.pycharm创建启动项目.生命周期.三件套.静态文件.请求及数据.配置Mysql完成数据迁移.单表ORM记录的增删改查

    一.Django项目的创建与介绍 ''' 安装Django #在cmd中输入pip3 #出现这个错误Fatal error in launcher: Unable to create process ...

  4. LATEX学习和IEEE Tran模板介绍

    目录 软件的选择 IEEE 模板下载 模板正文 图 表格 公式 算法 参考文献 Latex学习网站:http://www.latexstudio.net/page/tex-documents/ IEE ...

  5. Orchard之创建模板

    orchard创建模板的两种基本方式: 第一种:通过候补创建(需要用到候补神器): 第二种:通过Shape Tracing创建:

  6. Django创建模板、URL模式、创建视图函数

    1.在应用目录下创建模板(templates目录) 在模板目录下创建archive.html <!DOCTYPE html> <html lang="en"> ...

  7. 36.创建模板mylist

    node.h #pragma once //创建模板 template <class T> class Node { public: T t;//数据 Node *pNext;//指针域 ...

  8. 使用powercli创建模板与克隆虚机

    用powercli练练手,需从实际案例出发,本节将使用powercli写两个demo,一个是创建模板,并根据模板创建新的虚机:另一个demo是克隆虚机. [注意] 1.创建模板与克隆操作只能在vcen ...

  9. [人工智能]IBM Watson人工智能API|一步步创建智能微信翻译官|第一章

    最近参加了IBM可认知内部创业活动,想从零创建一个微信翻译工具,这就是我的AI翻译官.

随机推荐

  1. Js学习(1)基本语法

    变量: 用var声明变量,如果只是声明变量而不赋值,则变量的值是undefined,表示无定义 不写·var也有效,但不建议 变量声明两次无效,但第二次声明时赋值会覆盖掉前面的值 变量提升: Js引擎 ...

  2. vue2.0 动画

    //先来一个简单的入场 <template> <div id="box"> <input type="button" value= ...

  3. js函数定义和调用

    由于JavaScript的函数也是一个对象,上述定义的abs()函数实际上是一个函数对象,而函数名abs可以视为指向该函数的变量. var abs = function (x) { if (x > ...

  4. istio prometheus预警Prometheus AlertManager

    1.安装alertmanager kubectl create -f 以下文件 alertmanager-templates.yaml.configmap.yaml.deployment.yaml.s ...

  5. BZOJ 1227 [SDOI2009]虔诚的墓主人 - 扫描线

    Solution 离散化 扫描线, 并用 $rest[i]$ 和 $cnt[i]$ 记录 第$i$列 总共有 $cnt[i]$棵常青树, 还有$rest[i]$ 没有被扫描到. 那么 第$i$ 列的方 ...

  6. P3587 [POI2015]POD

    题目描述 长度为n的一串项链,每颗珠子是k种颜色之一. 第i颗与第i-1,i+1颗珠子相邻,第n颗与第1颗也相邻.切两刀,把项链断成两条链.要求每种颜色的珠子只能出现在其中一条链中.求方案数量(保证至 ...

  7. UI设计:C4D作品案例分享

    中文名4D电影,外文名CINEMA 4D,研发公司为德国Maxon Computer,特点为极高的运算速度和强大的渲染插件,使用在电影<毁灭战士>.<阿凡达>中,获得贸易展中最 ...

  8. RPDU

    RPDU(Remote Power Distribution Unit) 又称网络电源控制系统.远程电源管理系统.智能PDU.智能电源分配系统,是由傲视恒安科技(北京)有限公司自主研发生产并在全国范围 ...

  9. 上传文件 input file

    //-----前端文件------- form id="uploadForm" enctype="multipart/form-data"> <in ...

  10. .net使用NPOI的XSSFWorkbook进行web开发中导出Excel

    之前也使用过NPOI导出excel,这次是因为在导出的excel里新增了几个列,正好超出了255的限制,所以又要改了. 今天主要出了4个问题: 1. Invalid column index (256 ...