- 浏览: 1149884 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
MyEyeOfJava:
产生问题的主要原因:1.方洪波与南枫公司的直接主管李琼在合作共 ...
人力资源管理案例-左右为难的经理 -
吾名长弓:
学习了,作为一个管理新手,从文章里学到了很多东西,感谢 ...
2018新年管理感言 -
MyEyeOfJava:
非常不错,看过很多文章,说到管理者必然不能抛弃技术,我的主张是 ...
IT行业技术部门人员架构设计 -
小灯笼:
JMeter测试从入门到精通网盘地址:https://pan. ...
LR与Jmeter相关资料 -
flying6071:
“(2)CERT.SF:这是对摘要的签名文件。对前一步生成的M ...
Android签名与认证详细分析之一(CERT.RSA剖析)
在这篇文章里,我建议如果你想使用python或者java来进行sikuli的编程,请你深入的读一下我的文章,例如如何在java项目中使用sikuli。
你还需要知道一些用IDE开发的前置条件,例如如何在IDE里使用Jython
下面的方法只适用在windows 7 32位操作系统,以及Mac os X10.6,linux的使用者可以参考这些配置自己设置他们。
这可能是你选择使用IDE进行sikuli编程的一些理由:
- 你想开发sikuli插件
- 你需要debugger你的代码
- 你需要一个很好的交互
- 你需要和操作系统交互
- 你需要一个专业的单元测试
想这样操作sikuli的要求:
安装 Sikuli
- Windows: 同我之前的文章讲的一样,设置好你的sikuli环境变量
-
Mac: have Sikuli-IDE.app in its standard place /Applications. There is generally no need to put it elsewhere.
-
Linux: you generally have to take care for the environment yourself.
Meanings of shortcuts used:
- path-to/sikuli-script.jar if we use this, it should be replaced by the absolute path to the file sikuli-script.jar, where you installed Sikuli.
Images and importing other Sikuli scripts
It is recommended to carefully read through Importing other Sikuli Scripts (reuse code and images), since you need to have a concept how to capture, how to name and where to store your images. As a first start, just decide to use Sikuli IDE in parallel to capture and store your images and use the import feature or the image path to make them available in your script.
Netbeans
下面的例子是针对 Netbeans 6.9.的步骤:
安装python插件
你需要安装 Jython 2.5.1.
Go to menu Tools -> Plugins -> Available Plugins
In the list select everything that is in the category Python and install. If suggested by the install process always restart Netbeans.
Configure for using Sikuli script features at runtime
The plugin itself has nothing to configure, that is of value for the Sikuli usage. Everything is done on the project level, though some basic preferences act like plugin globals - we just have to know and accept this ;-)
下面是安装步骤:
- Start a new project: File -> New Project -> Categories: Python -> Python Project -> click Next
- In the second step Name and Location (last line), select as Python Platform: Jython 2.5.1.
- you might want to click Make Default, if you have real Python also available (Remember: Sikuli scripts cannot be run with real Python!)
- To integrate Sikuli: click the button Manage (only needed with the first project - it is remembered)
- on the tab Python Path we need an additional entry, that points to path-to/sikuli-script.jar/Lib.
- Windows: click the button Add and click through to path-to/sikuli-script.jar. Before clicking Open, edit the filename so that it shows sikuli-script.jar\Lib.
- Mac: since the Netbeans file dialog does not allow to dive into a bundle like Sikuli-IDE.app, we have to edit the preference file directly. Since it is the same with the Java path, we have documented it seperatly below Mac/Netbeans: select library path.
- on the tab Java Path we need an additional entry, that points to path-to/sikuli-script.jar. If you have other Java libraries, that you need in your project, add them here too.
- Windows: click the button Add and click through to path-to/sikuli-script.jar. Clicking Open.
- Mac: same again, see below Mac/Netbeans: Select library path.
Now you are able to run your first script. Remember, that in every script including the main script, that you are editing now, as the first line you need from sikuli.Sikuli import *, to have access to the Sikuli features at runtime.
Everytime later on you might come back to the project’s preferences with File -> Project Properties (your-project’s-name) . You will find the above information in the categorie Python.
Prepare to use Code Completion for the Sikuli methods
The NetBeans editor in the Python plugin editor is not able to recognize Python classes and methods, as long as the respective source code is embedded inside a jar-file as it is the fact with Sikuli. If you want Code Completion to work, you have to extract the folder Lib/sikuli from sikuli-script.jar, place it somewhere and add the reference to this folder to the Python Path in the project’s preferences (see above: Configure Python Path).
To extract the folder Lib/sikuli from sikuli-script.jar you might use the jar utility, that comes with the Java JDK or any other utility, that allows to unjar a jar-file.
This is a Mac example how to use the jar uility, supposing it can be found on the system path:
- in a Terminal window go to an appropriate folder, that should contain Lib/sikuli afterwards
- run: jar -xf /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar Lib/sikuli
You might decide, to use a folder, that is already on the Python path. One folder that is designated by Jython to contain complementary sources, that needs to be imported, is the folder Lib/site-packages in the Jython installation directory. If you copy the folder sikuli here, you do not need an additional Python path entry.
Mac/NetBeans: Select library path
To perpare the preference file modification we first add the path to Sikuli-IDE.app on both tabs: click the button Add and click through to /Applications/Sikuli-IDE.app. Depending on your selected language, the folder Applications is named like you see it in the Finder. Save the preferences by clicking close and/or ok.
The preference file is located at /Users/your-name/.netbeans/6.9/build.properties. Since it is hidden, you might have to use the Finder option “Go to Folder” (Shift-Command-G), to open the folder /Users/your-name/.netbeans/.
Open the file build.properties in your favorite editor and search for the text /Applications/Sikuli-IDE.app. It should be at the end of 2 lines beginning with pythonplatform..
On the line beginning pythonplatform. ... .javalib= extend /Applications/Sikuli-IDE.app so that it reads: /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar.
On the line beginning pythonplatform. ... .pythonlib= extend /Applications/Sikuli-IDE.app so that it reads: /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib.
Save the file and restart Netbeans. It is a good idea to check, that the correct entries are found on the 2 tabs now.
Eclipse
This is based on Eclipse Helios 3.6. We suppose you have it running in a setup that allows to at least develop Java applications.
Since this is not a tutorial how to use Eclipse in general, you should be familiar with the basic concepts.
Install Python plugin (PyDev) and Jython
Since the top level language used by Sikuli script is Python, you need the Python plugin PyDev. Different from NetBeans, though PyDev is prepared to use Jython as interpreter, you have to install Jython on your own seperately.
So first install Jython, by downloading the version you want to use from the Jython download page. Sikuli currently is based on Jython 2.5.1, but you may choose Jython 2.5.2 as well. Install it according to Jythons installation HowTo.
After installation, make a test from a commandline by typing jython.bat (Windows) or jython (Mac/Linux) to open an interactive Jython session.
You might type the following (<enter> means pressing the enter/return key)
- import os <enter>
- import sys <enter>
- for e in sys.path: print e <enter> <enter>
- type exit() <enter> (to leave interactive Jython)
This shows the current Jython configuration of the Python path. Remember the place where Jython is installed.
Now we install the PyDev plugin from inside Eclipse: Menu Help -> Eclipse Marketplace. Either search it or find it on the Popular tab’s lower part. Simply click the Install button and do what you are asked to do ;-)
The next step is to tell Eclipse PyDev, where it can find the Jython interpreter. Navigate to the Eclipse Preferences pane and open the category PyDev and inside the subcategoryInterpreter-Jython. First try to Auto Config by clicking the appropriate button. If this does not work, click the button New, name the entry and navigate to the folder, where Jython was installed and select jython.jar. After clicking ok, a window Selection needed might come up: click Select all and ok to finalize this step.
Other options with PyDev are available, but not relevant for our actual matter (see documentation).
Configure for using Sikuli script features at runtime
Again we have a difference to Netbeans: The PyDev plugin does not allow library references to folders inside of jar-files in the respective configuration dialog (it does not insert them to the Python path), though Jython itself accepts them, when specified on the Python path. So if you want to run and debug your script in Eclipse, you have to extract the folder Lib/sikuli from sikuli-script.jar (find one HowTo here).
As with Netbeans, the library configuration is done in the project itself. So we open a new project:
- Menu File -> New -> Project -> PyDev -> (open sublist) -> PyDev Project -> click Next button.
On the configuration pane name your project, select Jython as Project type, grammar version 2.5 (higher Python language versions are not supported by Jython 2.5.x) and click the Finish button. Your project is created. Add at least one you-name-it.py file to the source folder and put from sikuli.Sikuli import * as the first line.
In the last step, we tell PyDev, where to find the Sikuli libraries.
Goto Menu Project -> Properties -> select category PyDev - PYTHONPATH and go to the tab External Libraries. We need a reference to path-to/sikuli-script.jar and another one to the extracted folder Lib containing the folder sikuli.
- reference to path-to/sikuli-script.jar
- Windows: click button Add zip/jar/egg and select sikuli-script.jar from the Sikuli installation.
- Mac: As with NetBeans, the file dialog does not allow to step inside Sikuli-IDE.app. So we use the trick, to define a String Substitution Variable: on the respective tab click Add variable, name it e.g. sikuli-script and enter as value: /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar. Go back to the tab External Libraries and click Add based on variable. In the entry field enter: ${sikuli-script} and click OK.
- reference to the extracted folder Lib containing the folder sikuli
- click Add source folder and select the folder Lib in the place you had it extracted.
- this is not needed, if you have moved the extracted folder sikuli to a folder, that is already on the Python path (e.g. jython-intallation/Lib/site-packages).
Now you are able to run your first script. Remember, that in every script including the main script, that you are editing now, as the first line you need from sikuli.Sikuli import *, to have access to the Sikuli features at runtime.
Everytime later on you might come back to the project’s preferences with Project -> Properties.
Code Completion works from the start without any further configuration and even steps into the Java classes where appropriate.
不用看全文,光黑体字就完全可以明白了,不翻译了。
发表评论
-
[sikuli]ubuntu下安装sikuli
2012-05-03 15:16 2156会报错:libml.so.2.1 cannot open sh ... -
[sikuli]-设置环境,图片,OS等
2011-11-01 12:31 2754General Settings and Access ... -
[sikuli]-事件监听器
2011-11-01 12:31 2134Listening to Global Hotkeys ... -
[sikuli]-sikuli与用户的交互
2011-11-01 12:31 1547popup(text[, title]) ... -
[sikuli]-控制你的应用程序和窗口
2011-11-01 12:30 4092Here we talk about opening ... -
[sikuli]-控制你的sikuli脚本以及行为
2011-10-31 16:59 2894setShowActions(False | Tr ... -
[sikuli]-导入代码库和Jar
2011-10-31 16:56 2276# an example - choose your o ... -
[sikuli]-新特性,代码复用,强壮[everything]
2011-10-31 13:42 1361我的其他几篇文章: [sikuli]-siku ... -
[sikuli]-python脚本的一个简单例子
2011-10-31 11:51 3452def setUp(self): openApp ... -
[sikuli]-怎样在Java程序中运行你的sikuli脚本
2011-10-28 09:57 6175sikuli的核心内容是使用java进行编写的,这意味着你可以 ... -
[sikuli]-怎样为GUI创建单元测试脚本
2011-10-28 09:57 2467sikuli支持junit单元测试,在IDE里(windows ... -
[sikuli]-有关于sikuli的一点解释
2011-10-27 11:34 2359你能使用sikuli做什么,在什么地方可以使用? *如果你使 ... -
[sikuli]-设置窗口大小
2011-10-27 11:24 2724我们可以拖拽窗口的右下角来改变窗口的大小,那么我们就必须知道当 ... -
[sikuli]-while循环以及popup弹出窗
2011-10-27 11:05 7900这里以sns例,假如你想 ... -
[sikuli]-拖拽动作dragDrop
2011-10-27 10:34 2197样例图片: t = find ( ... -
[sikuli]-For与below
2011-10-27 10:28 2066sikuli中的For循环: ...
相关推荐
在软件开发领域,开发者常常会遇到使用不同IDE(集成开发环境)的情况,比如Eclipse与NetBeans。这两款IDE各有特色,Eclipse以其强大的插件系统著称,而NetBeans则在代码编辑、调试等方面提供了优秀的支持。在项目...
Apache-NetBeans-11.2-bin-windows-x64.exeApache-NetBeans-11.2-bin-windows-x64.exeApache-NetBeans-11.2-bin-windows-x64.exeApache-NetBeans-11.2-bin-windows-x64.exeApache-NetBeans-11.2-bin-windows-x64....
本文将详细介绍如何在Eclipse和NetBeans中设置Android开发环境,以便进行应用程序的编写和调试。 首先,我们关注的是Eclipse环境的搭建。Eclipse是一款强大的集成开发环境(IDE),广泛用于Java和Android应用开发。...
6. **数据库交互**:在MVC项目中,模型通常会与数据库进行交互,可能使用JDBC(Java Database Connectivity)或者ORM框架如Hibernate或MyBatis。 7. **版本控制**:这个示例可能使用Git进行版本控制,因为“-master...
在实际应用中,要将 Atom-Atom-Netbeans-Theme 主题导入到 NetBeans,用户通常需要按照以下步骤操作: 1. 首先,解压下载的 Atom-Atom-Netbeans-Theme.zip 文件,得到 Atom-Netbeans-Theme-master 文件夹。 2. 打开 ...
netbeans-8.2-windows.exe 全能开发工具
NetBeans包括开源的开发环境和应用平台,NetBeans IDE可以使开发人员利用Java平台能够快速创建Web、企业、桌面以及移动的应用程序,NetBeans IDE已经支持PHP、Ruby、JavaScript、Groovy、Grails和C/C++等开发语言。
Eclipse和NetBeansIDE Javadoc设置
根据提供的文件内容,以下是关于JEECG 3.6-Maven版本环境搭建在NetBeans中的相关知识点: ### 1. JDK 1.8安装与配置 - JDK(Java Development Kit)是开发Java应用程序所需的软件开发环境。 - 在搭建JEECG开发环境...
Apache-NetBeans 21安装包
本篇文章将详细介绍这款插件的功能、使用方法以及如何在Eclipse环境中进行安装和配置。 首先,JFormDesigner-5.1.1-eclipse.zip文件包含了插件所需的全部资源,包括CHANGELOG.html、THIRDPARTYLICENSES.html、...
netbeans-6.9.1-ml-windows.part1
具有一个独立的开发工具产品和基于不同开发工具如Eclipse、NetBeans等的开发插件。 人们很容易和直观的使用,并提供了许多强大的功能。 JFormDesigner完全支持JGoodies FormLayout , TableLayout , GridBagLayout...
"在 Netbeans 和 Eclipse 中添加 Tomcat ...添加 Tomcat 服务器是 Java web 开发的重要步骤,本文详细介绍了在 Netbeans 和 Eclipse 中添加 Tomcat 服务器的步骤,可以帮助开发者更好地理解服务器的概念和使用方法。
在Linux环境下,开发者经常使用NetBeans来创建、调试和部署应用程序,因为它提供了丰富的功能和优秀的代码编辑体验。 1. **NetBeans IDE 8.2特性**: - 支持多种编程语言:包括Java、C++、PHP、HTML5等,使得...
在这个项目中,开发者可能使用了NetBeans的特性如代码自动完成、项目管理以及调试功能来构建一个用户友好的求导计算程序。 描述中的“solve derivatives”意味着这个项目的核心是实现求解函数导数的功能。在数学中...
由于公司外网限制。需要的朋友可以搜索NetBeans-7.4-JavaSE-Windows。一起两个分卷。(仅Java)
NetBeans 是开源软件开发集成环境,是一个开放框架,可扩展的开发平台,可以用于 Java 等语言的开发,适用于Windows系统。
然而,这个标签与NetBeans IDE本身并不直接相关,可能是用户在使用NetBeans进行Android开发时涉及到的相关工具或教程。 压缩包子文件的文件名称“netbeans-7.3-javase-windows.exe”是一个Windows可执行文件,是...