Sign in to follow this  
Followers 0
bobbo

GUI Not functioning

7 posts in this topic

The Problem:

My GUI runs fine on my computer, but not on another computer at work. The GUI is displayed but no buttons work. To be more specific, the two buttons I created do not run their functions, and the Close button (the X) Doesn't work. Strangely though, the minimize button does work.

Notes:

1- The computer that the buttons don't work on does not have the full install of AutoIT, it only has the zip file extracted. Could this be part of the reason? Any registry keys that need to be created?

2- The script uses oneventmode,1

The Story:

I am developing a script for a coworker to automate some simple tasks he performs here. Our computers are identical, except his has some software that I dont have. Also, I have autoit installed and he doesn't. Work computers require admin rights to run the installer, so I either have to get his software on my PC, or the autoit software to run on his PC to test and develop the script.

Any help would be much appreciated and would save weeks of drone work!

Thanks in advance,

-Bobbo

"Time's fun when you're having flies" - Kermit

Share this post


Link to post
Share on other sites



The Problem:

My GUI runs fine on my computer, but not on another computer at work. The GUI is displayed but no buttons work. To be more specific, the two buttons I created do not run their functions, and the Close button (the X) Doesn't work. Strangely though, the minimize button does work.

Notes:

1- The computer that the buttons don't work on does not have the full install of AutoIT, it only has the zip file extracted. Could this be part of the reason? Any registry keys that need to be created?

2- The script uses oneventmode,1

The Story:

I am developing a script for a coworker to automate some simple tasks he performs here. Our computers are identical, except his has some software that I dont have. Also, I have autoit installed and he doesn't. Work computers require admin rights to run the installer, so I either have to get his software on my PC, or the autoit software to run on his PC to test and develop the script.

Any help would be much appreciated and would save weeks of drone work!

Thanks in advance,

-Bobbo

"Time's fun when you're having flies" - Kermit

Crystal ball not working on this computer.

A Shortened script displaying the problem you are having would greatly help.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Crystal ball not working on this computer.

A Shortened script displaying the problem you are having would greatly help.

There GUI just reads a notepad file containing names, one name per line, and splits them into first and last names.

#include <File.au3>
#include <array.au3>
#include <IE.au3> 
#include <GUIConstants.au3>
#include <GuiList.au3>
#include <String.au3>
#include <GuiEdit.au3>

global $sourcefile=@scriptdir&"\sourcenames.txt"
$handle=fileopen($sourcefile,1)
fileclose($handle)
ShellExecute($sourcefile)
global $title="sourcenames.txt - Notepad"

$MainGuiForm = GUICreate("Bobbys ACS Flagging Script", 500, 300, 198, 134,-1)
Opt("GUIOnEventMode", 1)
opt("GUICoordMode",0)
GUISetOnEvent($GUI_EVENT_CLOSE, "MainGuiFormClose")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainGuiFormMinimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "MainGuiFormMaximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "MainGuiFormRestore")


global $parsednamelist=GUICtrlCreateListView("First    |Last       ", 0, 25, 200, 200)
global $gobutton=guictrlcreatebutton("Split Names",0,210,80,15)
GUICtrlSetOnEvent(-1, "nameparser")
guictrlcreatelabel("Dealer",210,-210,250,15)
global $note=GUICtrlCreateInput("",0,15,250,50)
guictrlcreatelabel("Note",0,55,250,15)
global $dealer=GUICtrlCreateInput("",0,15,250,50)
guictrlcreatelabel("Other",0,55,250,15)
global $other=GUICtrlCreateInput("",0,15,250,50)
global $gobutton=GUICtrlCreateButton("Go",0,60,50,40)
GUICtrlSetOnEvent(-1,"go")


GUISetState(@SW_SHOW)
While 1
    Sleep(100)
WEnd

Func MainGuiFormClose()
    Exit
EndFunc
Func MainGuiFormMaximize()
    winsetstate("Bobbys ACS Flagging Script","",@SW_MAXIMIZE)
EndFunc
Func MainGuiFormMinimize()
    winsetstate("Bobbys ACS Flagging Script","",@SW_MINIMIZE)
EndFunc
Func MainGuiFormRestore()
    winsetstate("Bobbys ACS Flagging Script","",@SW_RESTORE)
EndFunc


func nameparser()
    WinActivate($title)
    WinWaitActive($title)
    send("^s")  
    winclose($title)
    winwaitclose($title)
    sleep(500)
    global $namesarray
    if _FileReadToArray($sourcefile,$namesarray) Then
        for $i=1 to $namesarray[0]
            $name=StringRegExpReplace($namesarray[$i],"(, )|( )","|")           
            _guictrllistviewinsertitem($parsednamelist,$i-1,$name)
        Next
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

There might be better ways to get the data, might think about going to the latest beta, the functions have been changed/improved and many more functions added.

Would think about using the GUIEdit_xxxxx functions to get the data from notepad would be no need to save to file then.

I'm sure there are probably other things that could be done that users will suggest/show.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

There might be better ways to get the data, might think about going to the latest beta, the functions have been changed/improved and many more functions added.

Would think about using the GUIEdit_xxxxx functions to get the data from notepad would be no need to save to file then.

I'm sure there are probably other things that could be done that users will suggest/show.

I have tried using the GUIctrledit functions, it did work but was a bit harder there aren't as many functions for it - like I didn't see a read edit to array line by line function.

Regardless, the gui window as a whole does not call functions when I push any of the buttons, it just sits there like it's "sleeping"

Any ideas? BTW I am using the latest beta.

Thanks in advance.

Share this post


Link to post
Share on other sites

I have tried using the GUIctrledit functions, it did work but was a bit harder there aren't as many functions for it - like I didn't see a read edit to array line by line function.

Either read 1 line at a time and loop and using _GUICtrlEdit_GetLine, _GUICtrlEdit_GetLineCount you can populate an array or

use _GUICtrlEdit_GetText and use StringSplit on it to create array.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Either read 1 line at a time and loop and using _GUICtrlEdit_GetLine, _GUICtrlEdit_GetLineCount you can populate an array or

use _GUICtrlEdit_GetText and use StringSplit on it to create array.

Good call.

And good news: I found the bug! The second computer had windows hiding extensions, so "sourcenames.txt - Notepad" appears as "sourcenames - Notepad." The script was simply sleeping for a winwaitactive() where the title was wrong!

The script is working great now. I really appreciate your responses; hopefully I'll be able to return the favor sometime!

Share this post


Link to post
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
Sign in to follow this  
Followers 0