如何将外部au3(AutoIt)文件包含到Ruby中?

如何将外部au3(AutoIt)文件包含到Ruby中?,ruby,include,pixel,autoit,win32ole,Ruby,Include,Pixel,Autoit,Win32ole,我通过Ruby WIN32OLE调用AutoItX在windows中实现一些自动化,遇到了一个场景,我必须从屏幕获取像素颜色,并在消息框中显示颜色。Autoit没有内置msgbox方法,因此必须通过包含外部文件来实现 这在Autoit中运行良好,如下所示: #include <MsgBoxConstants.au3> Local $iColor = PixelGetColor(10, 100) MsgBox($MB_SYSTEMMODAL, "", "The decimal co

我通过Ruby WIN32OLE调用AutoItX在windows中实现一些自动化,遇到了一个场景,我必须从屏幕获取像素颜色,并在消息框中显示颜色。Autoit没有内置msgbox方法,因此必须通过包含外部文件来实现

这在Autoit中运行良好,如下所示:

#include <MsgBoxConstants.au3>

Local $iColor = PixelGetColor(10, 100)

MsgBox($MB_SYSTEMMODAL, "", "The decimal color is: " & $iColor)
MsgBox($MB_SYSTEMMODAL, "", "The hex color is: " & Hex($iColor, 6))
我需要做的是在当前脚本中包含外部AutoIt函数。 我希望以一种标准的方式进行(稍后计划扩展)。那么,如何将au3文件包含到我的ruby脚本中呢?

MsgBox()在AutoItX中不可用,但您可以直接从ruby调用MessageBox函数

MessageBox API文档:


PixelGetColor是标准的AutoIT功能。PixelGetColor(10100)应该可以,是的,谢谢你指出这一点。从那时起我就编辑了这个问题,现在它清楚地表明了我需要一个外部文件来创建一个消息框。
require 'win32ole'

# create autoit object from win32ole
puts 'Creating oAutoIt Object...'
oAutoIt = WIN32OLE.new("AutoItX3.Control")

# open MEmu
puts 'Opening MEmu'
MEmu_pid = oAutoIt.Run "C:/Program Files/Microvirt/MEmu/MEmu.exe", "", oAutoIt.SW_SHOWNORMAL
#MEmu_pid = oAutoIt.RunWait "C:/Program Files/Microvirt/MEmu/MEmu.exe", "", oAutoIt.SW_SHOWNORMAL # => pauses the script waits for MEmu to finish.
puts "MEmu is running | PID #{MEmu_pid}"