找回密码
 加入
搜索
查看: 7826|回复: 5

[AU3基础] [已解决]编译好的exe中run .au3报错Error opening the file

[复制链接]
发表于 2013-5-31 09:59:09 | 显示全部楼层 |阅读模式
本帖最后由 jun232526668 于 2013-5-31 10:56 编辑

遇到一个很奇怪的问题, 谢谢大家帮我看看:
1.testa.au3
Local $file_loc = "C:\test\testb.au3"

Run(@AutoItExe & " /AutoIt3ExecuteScript " & $file_loc)
2.testb.au3
#include <File.au3>

Local $logFile = "testb.log"
If FileExists($logFile) == 0 Then
   _FileCreate($logFile)
EndIf

Local $file = FileOpen($logFile, 1)
Local $message = "hello test"   
If $file = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf
FileWriteLine($file, $message)
MsgBox(0,$message,$message)
现在需要把testa.au3打成exe,然后双击运行, 让exe再来调testb.au3.
结果报下面这个错误:
AutoIt Error
Line1 (File "C:\test\testb.au3")
#include <File.au3>
Error: Error opening the file

直接运行testa.au3脚本,代码都是可以正常运行的, 这个是不是和@Compiled有关系啊?实在找不到问题的原因了..麻烦指导下
发表于 2013-5-31 10:18:33 | 显示全部楼层
在编译后 @AutoItExe 指向的就是编译的脚本,而非 AutoIt3.exe 了。
 楼主| 发表于 2013-5-31 10:35:10 | 显示全部楼层
哦...非常感谢..好像是这个地方的问题,我去试一下
 楼主| 发表于 2013-5-31 10:46:00 | 显示全部楼层
谢谢afan, 不用@AutoItExe这个宏问题就解决了, 但是还有没有别的方法能自己找到AutoIt3.exe啊?
发表于 2013-5-31 10:52:00 | 显示全部楼层
如果是针对Au3用户使用可以读取注册表,否则的话需要将Autoit相关的Exe文件打包进编译,且脚本最好整合所有的 #include 文件。
 楼主| 发表于 2013-5-31 10:53:26 | 显示全部楼层
好的..明白了..谢谢超级版主
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-29 03:35 , Processed in 0.105937 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表