Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Air桌面应用程序中两个监视器的全屏显示仍然显示菜单栏,直到单击_Actionscript 3_Air_Applescript - Fatal编程技术网

Actionscript 3 Air桌面应用程序中两个监视器的全屏显示仍然显示菜单栏,直到单击

Actionscript 3 Air桌面应用程序中两个监视器的全屏显示仍然显示菜单栏,直到单击,actionscript-3,air,applescript,Actionscript 3,Air,Applescript,这让我发疯。。。 我为Macos创建了一个air Native应用程序。 计算机正在运行MacOs 10.10 我在这里试过这个 无济于事。到目前为止似乎没有什么变化 但是,还有其他办法吗? 我尝试了苹果脚本: tell application "System Events" tell process "myapp" delay (5) click at {100, 100} end tell 但是捕鼠人甚至没有在空中开火。。。尽管applesript说: 应用程序进程的窗口m

这让我发疯。。。 我为Macos创建了一个air Native应用程序。 计算机正在运行MacOs 10.10

我在这里试过这个 无济于事。到目前为止似乎没有什么变化

但是,还有其他办法吗? 我尝试了苹果脚本:

tell application "System Events"
tell process "myapp"
    delay (5)
    click at {100, 100}
end tell
但是捕鼠人甚至没有在空中开火。。。尽管applesript说:

应用程序进程的窗口myapp应用程序系统事件的adl

还有什么我可以试试的吗?
谢谢

经过长时间的搜索,当我在Stackoverflow上找到一个控制鼠标的python脚本时,我找到了一个答案:

Python脚本是:

from Quartz.CoreGraphics import CGEventCreateMouseEvent
from Quartz.CoreGraphics import CGEventPost
from Quartz.CoreGraphics import kCGEventMouseMoved
from Quartz.CoreGraphics import kCGEventLeftMouseDown
from Quartz.CoreGraphics import kCGEventLeftMouseDown
from Quartz.CoreGraphics import kCGEventLeftMouseUp
from Quartz.CoreGraphics import kCGMouseButtonLeft
from Quartz.CoreGraphics import kCGHIDEventTap

def mouseEvent(type, posx, posy):
    theEvent = CGEventCreateMouseEvent(
                None, 
                type, 
                (posx,posy), 
                kCGMouseButtonLeft)
    CGEventPost(kCGHIDEventTap, theEvent)

def mousemove(posx,posy):
    mouseEvent(kCGEventMouseMoved, posx,posy);

def mouseclick(posx,posy):
    # uncomment this line if you want to force the mouse 
    # to MOVE to the click location first (I found it was not necessary).
    #mouseEvent(kCGEventMouseMoved, posx,posy);
    mouseEvent(kCGEventLeftMouseDown, posx,posy);
    mouseEvent(kCGEventLeftMouseUp, posx,posy);
mouseclick(200,200)
然后我通过NativeProcess调用这个脚本。 该类在应用程序存储目录中生成python文件并运行它。 我在onFullscreenEvent处理程序上运行它。 在这里使用MacOS 10.10.3非常有魅力

干杯

package  {

    import flash.events.IOErrorEvent;
    import flash.filesystem.FileStream;
    import flash.filesystem.FileMode;
    import flash.events.Event;
    import flash.desktop.NativeProcess
    import flash.events.NativeProcessExitEvent
    import flash.desktop.NativeProcessStartupInfo
    import flash.events.ProgressEvent;
    import flash.filesystem.File;
    public class MouseClick extends Object {
        private static var process:NativeProcess
        private static var _pythonfilepath:String
        private static var _pythonfilename:String="MouseClick.py"
        private static var _pythonfile:File
        private static var _pythonstring:String="from Quartz.CoreGraphics import CGEventCreateMouseEvent\nfrom Quartz.CoreGraphics import CGEventPost\nfrom Quartz.CoreGraphics import kCGEventMouseMoved\nfrom Quartz.CoreGraphics import kCGEventLeftMouseDown\nfrom Quartz.CoreGraphics import kCGEventLeftMouseDown\nfrom Quartz.CoreGraphics import kCGEventLeftMouseUp\nfrom Quartz.CoreGraphics import kCGMouseButtonLeft\nfrom Quartz.CoreGraphics import kCGHIDEventTap\n\ndef mouseEvent(type, posx, posy):\n        theEvent = CGEventCreateMouseEvent(\n                    None, \n                    type, \n                    (posx,posy), \n                    kCGMouseButtonLeft)\n        CGEventPost(kCGHIDEventTap, theEvent)\n\ndef mousemove(posx,posy):\n        mouseEvent(kCGEventMouseMoved, posx,posy);\n\ndef mouseclick(posx,posy):\n        # uncomment this line if you want to force the mouse \n        # to MOVE to the click location first (I found it was not necessary).\n        #mouseEvent(kCGEventMouseMoved, posx,posy);\n        mouseEvent(kCGEventLeftMouseDown, posx,posy);\n        mouseEvent(kCGEventLeftMouseUp, posx,posy);\nmouseclick(200,200)";
        public function MouseClick(){
            super();    

        };

        public static function click(): void {
            _pythonfile=File.applicationStorageDirectory.resolvePath(_pythonfilename)
            _pythonfilepath=_pythonfile.nativePath;
            //
            if(!_pythonfile.exists){ 
                    _pythonfile = new File(_pythonfilepath);
                    var fileStream:FileStream = new FileStream();
                    fileStream.open(_pythonfile, FileMode.WRITE);
                    fileStream.writeUTFBytes(_pythonstring);
                    fileStream.close();
            }

            var nativeProcessStartupInfo: NativeProcessStartupInfo = new NativeProcessStartupInfo();
            var file:File = File.applicationDirectory.resolvePath("/usr/bin/python");
            nativeProcessStartupInfo.executable = file;

            var link =File.applicationDirectory.resolvePath("MouseClick.py").nativePath

            var processArgs: Vector.<String> = new Vector.<String> ();

            processArgs[0] = _pythonfilepath;
            nativeProcessStartupInfo.arguments = processArgs;
            process = new NativeProcess();
            process.start(nativeProcessStartupInfo);
            addNativeProcessListeners();
        }
        private static function removeNativeProcessListeners():void{
                process.removeEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
                process.removeEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
                process.removeEventListener(NativeProcessExitEvent.EXIT, onExit);
                process.removeEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
                process.removeEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
        };
        private static function addNativeProcessListeners():void{
                process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
                process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
                process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
                process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
                process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
        };
        public static function onOutputData(event: ProgressEvent): void {
            removeNativeProcessListeners()
        }

        public static function onErrorData(event: ProgressEvent): void {
            trace("could not send video successfully error: "+process.standardError.readUTFBytes(process.standardError.bytesAvailable),"err")
            removeNativeProcessListeners()
        }

        public static function onExit(event: NativeProcessExitEvent): void {

            removeNativeProcessListeners()

        }
        public static function onIOError(event: IOErrorEvent): void {
            trace("could not send video successfully error onIOError: "+event.toString(),"err");
        }

    }

}