Jump to content

compile 2 exe has 'no action' but script runs normal


Recommended Posts

Now two problem worry me a lot. Hope the professionals give me a hand.

No1. when in the status of script, it runs normal. after compiling, it can be executed, but no any action.

No2. how to deal with the control of QWidge. the function 'ControlClick' etc. don't have effection....

expect your help...

Link to comment
Share on other sites

  • Moderators

Cupidkidd,

Welcome to the AutoIt forum. :)

Please post your code so that we can see why you might be having this problem - at the moment we can offer no real help at all. When you post please put [autoit] before and [/autoit] after the code so it appears correctly. ;)

There are a number of QWidget threads on the forum - I see you have found some of them already - and these may help you with the second part of your question. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank Melba23 to reminder me. Here is the code for the first question. There are Chinese words in the code, I doubt whether friends could understand me...

It's a simple application. I mean to get text from some textboxes in a window automaticlly. Then write the data into a text file, and an opening notepad as well.

When I run it in the SCiTE(ACN) 2.29, it goes well. After compiling to exe, it runs with no effection...

WinWait("通用测量","开始测量")
Local $var_file = "C:\record.txt"
Local $file_id = FileOpen ($var_file,1)
If $file_id=-1 Then
MsgBox (0, "", "文件有错误,必须退出脚本!")
Exit
EndIf

Run("notepad.exe")
WinWaitActive("无标题 - 记事本") ;"untitled - notepad"

ControlSend("无标题 - 记事本", "", "Edit1", "年-月-日 时:分:秒" & @TAB & "CO" & @TAB & "CO2" & @TAB & "HC" & @TAB & "NO" & @TAB & "O2" _
& @TAB & "λ" & @TAB & "油温" & @TAB & "转速{ENTER}")
FileWriteLine($file_id, "年-月-日 时:分:秒" & @TAB & "CO" & @TAB & "CO2" & @TAB & "HC" & @TAB & "NO" _
& @TAB & "O2" & @TAB & "λ" & @TAB & "油温" & @TAB & "转速")
;code up write the data title like date, oxygen, etc.

Local $var_time = ""
Local $var_data = ""
While WinExists("通用测量", "开始测量")
$var_time = @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC
$var_data = ControlGetText("通用测量", "开始测量", "Edit2") & @TAB & ControlGetText("通用测量", "开始测量", "Edit3") _
& @TAB & ControlGetText("通用测量", "开始测量", "Edit4") & @TAB & ControlGetText("通用测量", "开始测量", "Edit5") _
& @TAB & ControlGetText("通用测量", "开始测量", "Edit6") & @TAB & ControlGetText("通用测量", "开始测量", "Edit7") _
& @TAB & ControlGetText("通用测量", "开始测量", "Edit8") & @TAB & ControlGetText("通用测量", "开始测量", "Edit9")

ControlSend("无标题 - 记事本", "", "Edit1", $var_time & @TAB & $var_data & "{ENTER}")
FileWriteLine($file_id, $var_time & @TAB & $var_data)

Sleep(560)
WEnd

FileClose($file_id)
MsgBox(0, "", "五气上位机测量窗体已经关闭,退出脚本!")
Edited by Cupidkidd
Link to comment
Share on other sites

  • Moderators

Cupidkidd,

I suggest you add some errorchecking to the script to see if it actually runs as you think it should once compiled. Some MsgBoxes at critical points giving you the return values from recently called functions would be a good place to start - it will also allow you to check that the script actually runs and does not hang at some point.

Otherwise, I see you are trying to write to the root of the C drive - not something I would reccomend given the manner in which Vista+ protects certain areas. I would suggest changing that patht to something less likely to cause problems - but if you must use it then you might want to try adding #requireadmin to the top of the script to allow the necessary permissions.

Any use? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You're right. I forgot the authority of administrator. So I added #requireadmin as you suggested.

Now, the first problem is solved naturally. I didn't do anything, just re-compile it and test. It worked normally.

Thank you, Melba23. And I'll continue to focus on the second problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...