This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.events.MouseEvent; | |
import mdm.Application; | |
import mdm.Forms; | |
import mx.core.UIComponent; | |
import spark.components.Application; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
<link rel="stylesheet" href="./jquery.mobile.css" /> | |
<script type="application/javascript" src="./jquery.js"></script> | |
<script type="application/javascript" src="./jquery.mobile.js"></script> | |
</head> | |
<body> | |
<!-- page start --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" | |
width="800" height="600" applicationComplete="appInit()" backgroundColor="#000000"> | |
<fx:Script> | |
<![CDATA[ | |
import mdm.Application; | |
import mdm.FileSystem; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set backgroundFile to POSIX file "/Users/kacper/desktop/runningApplication.jpg" as string | |
set desktop picture to file backgroundFile | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# content of message | |
set messageContent to "Hello Johh,\rCan you check below information for me?\r....\n...\nregards,\rPeter" | |
# code to script Mail.app to create new message in new window | |
tell application "Mail" | |
# bring to front | |
activate | |
# create new message and make it visible for edition | |
set newMessage to make new outgoing message with properties {visible:true, subject:"message subject", content:messageContent} | |
# set properties of message | |
tell newMessage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set theEthernetAddress to primary Ethernet address of (get system info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function computePath(path:String):String | |
{ | |
// in Zinc context convert path to absolute one | |
// and to file protocol notation | |
if(mdm.Application && mdm.Application.path) | |
{ | |
// convert path to FILE protocol Unix notation | |
return "file://"+mdm.Application.path.split("\\").join("/")+path; | |
}; | |
// otherwise return as-is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function applicationCompleteHandler(event:FlexEvent):void | |
{ | |
mdm.Application.init(); | |
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler); | |
} | |
protected function onMouseMoveHandler(event:MouseEvent):void | |
{ | |
// first unregister event | |
this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler); | |
// then exit lazily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function applicationCompleteHandler(event:FlexEvent):void | |
{ | |
mdm.Application.init(); | |
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardEventDownHandler); | |
} | |
protected function onKeyboardEventDownHandler(event:MouseEvent):void | |
{ | |
// first unregister event | |
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyboardEventDownHandler); | |
// then exit lazily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// util method | |
protected function isFirstInstance():Boolean | |
{ | |
const CONNNECTION_NAME:String = "__MY_APP_CHECK_HASH__"; | |
var lc:LocalConnection = new LocalConnection(); | |
// try/catch | |
// assume that ArgumentError is thrown when connection already exists | |
// as per documentation | |
try{ | |
lc.connect(CONNNECTION_NAME); |