Jump to content
Sign in to follow this  
SmOke_N

GUI works in .au3 not .exe?

Recommended Posts

Ok, 1st off, many thanks to Cyberslug/Lar, what would of taken most of you to do in 10 mins, has taken me 10 hours. I've got my GUI script to work in .au3, with the other scripts in .exe, however when I compile my GUI to exe, it brings up a clone GUI window without running the script I've called for.

GUI:

#include <GUIConstants.au3>
Global $Paused

GUICreate("PPDB", 400, 400)
$P1 = HotKeySet("{PAUSE}", "TogglePause")
$var = WinList()
; BUTTON
$Button1 = GUICtrlCreateButton("1-OK", 10, 135, 120, 30)
$Button2 = GUICtrlCreateButton("25-OK", 140, 135, 120, 30)
$Button3 = GUICtrlCreateButton("50-OK", 270, 135, 120, 30)
$Button4 = GUICtrlCreateButton("G-M", 10, 170, 120, 30)
$Button5 = GUICtrlCreateButton("Q-K", 140, 170, 120, 30)
$Button6 = GUICtrlCreateButton("510-O", 270, 170, 120, 30)
$Button7 = GUICtrlCreateButton("100-200-O", 140, 205, 120, 30)
$list = GUICtrlCreateCombo("", 5, 101, 390, 30)
Dim $x = -1
For $i = 1 To $var[0][0]
   If $var[$i][0] = "" Then ContinueLoop
   If IsVisible($var[$i][1]) Then
      $x = $x + 1
      GUICtrlSetData($list, $var[$i][0] & "|")
   EndIf
Next


;Input
$PauseButton = GUICtrlCreateButton("Pause", 200, 55, 60, 30, $P1)
$Notice = GUICtrlCreateLabel("(***Notice -- This Program Is For Education Use Only***, )", 73, 245, 391, 20)


;Date
$Date = GUICtrlCreateDate("", 145, 10, 200, 20)
$DateLabel = GUICtrlCreateLabel("(Date control expands into a calendar)", 155, 30, 200, 20)

; Icon
$n1 = GUICtrlCreateIcon(@WindowsDir & "\cursors\horse.ani", -1, 20, 255, 32, 32)



GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $Button1
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\1-OK.exe" & " " & GUICtrlRead($list))
      Case $msg = $Button2
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\25-OK.exe" & " " & GUICtrlRead($list))
      Case $msg = $Button3
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\50-OK.exe" & " " & GUICtrlRead($list))      
      Case $msg = $Button4
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\G-M.exe" & " " & GUICtrlRead($list))        
      Case $msg = $Button5
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\Q-K.exe" & " " & GUICtrlRead($list))        
      Case $msg = $Button6
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\510-O.exe" & " " & GUICtrlRead($list))
      Case $msg = $Button7
         EnvSet("foo", GUICtrlRead($list))
         Run("C:\Documents and Settings\Masta\Desktop\PPDB 1280-1040\100-200-O.exe" & " " & GUICtrlRead($list))      
         
   EndSelect
WEnd

Func IsVisible($handle)
   If BitAND( WinGetState($handle), 2) Then
      Return 1
   Else
      Return 0
   EndIf
   
EndFunc ;==>IsVisible

Func TogglePause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
      ToolTip('Script is "Paused"', 0, 0)
   WEnd
   ToolTip("")
EndFunc ;==>TogglePause

.exe script

;SCRIPT NAME:  1-OK.exe
;Set Name of Window
Global $t1 = EnvGet("foo")


WinActivate("Untitled """ & $t1);

; Main Loop
While WinExists($t1)
   Sleep(300);
   
   $Blah1 = ControlGetText("Untitled", "Blah1", 1012)
   If $Blah1 = "Blah1" Then
   ; Mouse clicking from text found blah1
      WinWait($t1)
      If Not WinActive($t1) Then WinActivate($t1)
      WinWaitActive($t1)
      MouseMove(Random(429, 512), Random(532, 556))
      MouseDown("left")
      MouseUp("left")
      Sleep(Random(0, 3000))
   EndIf
   
   $Blah2 = ControlGetText("Connected to", "Blah2", 1012)
   If $Blah2 = "Blah2" Then
   ; Mouse clicking from text found blah2
      WinWait($t1)
      If Not WinActive($t1) Then WinActivate($t1)
      WinWaitActive($t1)
      MouseMove(Random(554, 641), Random(528, 559))
      MouseDown("left")
      MouseUp("left")
      Sleep(Random(0, 3000))
   EndIf
   
   $Blah3 = ControlGetText("Connected to", "Blah3", 1012)
   If $Blah3 = "Blah3" Then
   ; Mouse clicking from text found blah3
      WinWait($t1)
      If Not WinActive($t1) Then WinActivate($t1)
      WinWaitActive($t1)
      MouseMove(Random(554, 641), Random(528, 559))
      MouseDown("left")
      MouseUp("left")
      MouseMove(Random(701, 717), Random(534, 542))
      MouseDown("left")
      MouseUp("left")
      Sleep(Random(0, 3000))
   EndIf
   
   $Blah4 = ControlGetText("Connected to", "Blah4", 1012)
   If $Blah4 = "Blah4" Then
   ; Mouse Clicking from text found blah4
      WinWait($t1)
      If Not WinActive($t1) Then WinActivate($t1)
      WinWaitActive($t1)
      MouseMove(637,483)
      MouseDown("left")
      MouseMove(675,486)
      MouseUp("left")
      Sleep(Random(3000, 6000))
      Send(Random(150, 250, 1) & "{ENTER}")
      MouseMove(Random(681, 767), Random(529, 557))
      MouseDown("left")
      MouseUp("left")
      Sleep(Random(0, 3000))
   EndIf
   
   $Blah5 = ControlGetText("Connected to", "Blah5", 1012)
   If $Blah5 = "Blah5" Then
   ; Mouse clicking from text found blah5
      WinWait($t1)
      If Not WinActive($t1) Then WinActivate($t1)
      WinWaitActive($t1)
      MouseMove(637,483)
      MouseDown("left")
      MouseMove(675,486)
      MouseUp("left")
      Sleep(Random(3000, 6000))
      Send(Random(400, 800, 1) & "{ENTER}")
      MouseMove(Random(681, 767), Random(529, 557))
      MouseDown("left")
      MouseUp("left")
      Sleep(Random(0, 3000))
   EndIf
   
WEnd

I'm now wondering if I'm answering my own question, to compile the GUI, and leave the scripts as .au3. I will try that, but in the mean time if anyone sees something that could help, it would be appreciated.

Thanks

Ron


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Um, don't comment, I found the problem (see this stuff is not trivial for beginners). I forgot to put the .dll files into the folder. :D

THANK YOU CYBERSLUG!!!!!!!!!!! :)

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...