注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

山歌

微信公众号:Jack-Xiaoshan

 
 
 
 
 

日志

 
 

AIR本地化EXE  

2009-10-13 22:41:18|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
AIR中获取程序当前目录之shu特别篇 一般情况下,获取程序当前目录是很简单的,不过如果用shu打包后的AIR程序用常规方法是无法获取的,获取到的也是程序的执行的时候临时解压的目录,与我们想要的结果相差甚远。 经过查阅资料发现,可以使用shu.System.Paths.app来获取,非常准确方便。 要知道,shu的功能,是没法调试的,只有打包看结果了哦。 shu:是一个非常优秀的工具。 http://shu-player.com

Command List

In order for these functions to be available, you need to include the Shu.swc in your AIR project. Instructions can be found here.

Executing other applications

shu.System.exec(filename:String, showGui:Boolean=false):Number show

Overview:
Executes an external application and waits for it to exit.
Parameters:
filename - String specifing path to an application to execute. showGui - Boolean specifing whether to display the application's GUI.
Returns:
The exit code of the program launched.

shu.System.execAsync(filename:String, showGui:Boolean=false):Number show

Overview:
Executes an external application asynchronously. The return value is the application process ID which can be used to check if the application is still running by calling shu.System.isRunning.
Parameters:
filename - String specifing path to an application to execute. showGui - Boolean specifing whether to display the application's GUI.
Returns:
The process ID of the launched application.

shu.System.isRunning(pid:Number):Boolean show

Overview:
Determine if the application specified by process ID is still running.
Parameters:
pid - The process ID to check.
Returns:
A boolean value of true indicates the application is still running, false otherwise.

shu.System.launchFile(filename:String):Boolean show

Overview:
Opens a file in the systems default assigned application.
Parameters:
filename - The file to open.
Returns:
A boolean value of true to indicate the file was opened, false otherwise.

shu.System.lastOutput:String show

Overview:
This property has the output of the last executed application (either executed via shu.System.exec or shu.System.execAsync).
Returns:
A string of the last executed applications output.

Database access

shu.MySQL.connect(host:String, port:Number, user:String, pass:String, dbName:String):Boolean show

Overview:
Connect to a MySQL database.
Parameters:
host - The URL to connect to. port - The port number the MySQL database is running on. user - The username to use when connecting. pass - The password to use when connecting. dbName - The database to use.
Returns:
A boolean value of true if succesfuly connected, false otherwise.

shu.MySQL.disconnect():void show

Overview:
Disconnect the MySQL database.

shu.MySQL.runQuery(query:String):Boolean show

Overview:
Run a query on the connected MySQL database.
Parameters:
query - A string of the query.
Returns:
A boolean value of true if the query executed succesfuly.

shu.MySQL.fetchRow():Array show

Overview:
Fetch the next row of a resultset from the last query. This can be called repeatidly to get all the results.
Returns:
An array of the row. Each element is a string.

shu.MySQL.seekRow(which:Number):Boolean show

Overview:
Seek to a specific row in the last resultset.
Parameters:
which - The row index, zero based.
Returns:
A value of true if the row was moved to, otherwise false.

shu.MySQL.rowCount:Number show

Overview:
This property has the number of rows in the last resultset.
Returns:
A number indicating the number of rows.

shu.MySQL.lastError:String; show

Overview:
This has the last error message encountered. This can be useful in diagnosing unexpected results.
Returns:
A string of the last error message.

Prompts and message boxes

shu.Dialogs.messageBox(message:String, caption:String, style:Number):Number show

Overview:
Displays a modal system messagebox.
Parameters:
message - The message to display. caption (optional) - The caption to display in the title bar of the messagebox. style (optional) - The buttons and icons to show. This is constructed by OR'ing the style properties :
  • shu.Dialogs.MB_OK
  • shu.Dialogs.MB_CANCEL
  • shu.Dialogs.MB_YES_NO
  • shu.Dialogs.MB_ICON_ERROR
  • shu.Dialogs.MB_ICON_INFORMATION
  • shu.Dialogs.MB_ICON_QUESTION
  • shu.Dialogs.MB_ICON_EXCLAMATION
Returns:
The numerical ID of the button clicked. It will be one of:
  • shu.Dialogs.MB_OK
  • shu.Dialogs.MB_CANCEL
  • shu.Dialogs.MB_YES
  • shu.Dialogs.MB_NO

shu.Dialogs.inputBox(message:String, caption:String, defaultValue:String):String show

Overview:
Displays a system input box dialog. The user enters a one line string and presses OK.
Parameters:
message - The message above the input textfield. caption (optional) - The text to appear in the titlebar of the dialog. defaultValue (optional) - An initial string of text to appear in the input textfield.
Returns:
The string of text the user entered.

Paths

These properties give you some common file system paths. Note they are all read-only.

shu.Paths.app:String show

Returns:
A string specifing the location the application resides at.

shu.Paths.desktop:String show

Returns:
A string specifing the location the users desktop.

shu.Paths.documents:String show

Returns:
A string specifing the location the users default documents directory.

shu.Paths.temp:String show

Returns:
A string specifing the location the systems temporary directory.

Screen

shu.Screen.capture(filename:String,left:Number,top:Number,right:Number,botton:Number):Boolean show

Overview:
Capture an image of the screen (or part of the screen) to a file. Note that this function either takes just the first parameter or all parameters. If only the filename is supplied, the whole screen is captured. Otherwise the area specified by left, top, right and bottom is captured. The file to save to can be either a png, jpg, tiff or bmp and will be determined by the filenames extension.
Parameters:
filename - A string specifing the path to save the file to. left (optional) - The leftmost position to capture. top (optional) - The topmost position to capture. right (optional) - The rightmost position to capture. bottom (optional) - The bottom-most position to capture.
Returns:
A boolean value of true if the file was saved successfully, false otherwise.

Extend via custom DLL/dylib

N.B. The DLL/dylib must be an shu extension (eg it must implement the extapi)

shu.Extension.call(handlerName, ...):* show

  评论这张
 
阅读(15)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017