Sign in to follow this  
Followers 0
friends

[ Help ] Please help me to fix this

4 posts in this topic

Please help me to fix the below.

When I click on the "MIS User" button, I wanted the "CANCEL" and "OK" button

clickable. I'm not sure where had gone wrong with my coding.

Please help. Thanks.

#include <GUIConstants.au3>

Opt ("TrayIconDebug", 1)


$VERSION = "Stock Take System"
If WinExists($VERSION) Then
   MsgBox(48, "Stock Take System", "Application is already running.....", 3)
   Exit
EndIf

AutoItWinSetTitle($VERSION)



$Menu = GUICreate ("The Store - Stock Take System", 300, 200)
; 1st Button
$EndUser = GUICtrlCreateButton ("&User", -1, -1, 100, 100, $BS_ICON)
GUICtrlSetImage ($EndUser, "shell32.dll",160)
; 2nd Button
$MISUser = GUICtrlCreateButton ("&MIS User", 100, -1, 100, 100, $BS_ICON)
GUICtrlSetImage ($MISUser, "shell32.dll",111)   
; 3rd Button
$Exit = GUICtrlCreateButton ("E&xit", 200, -1, 100, 100, $BS_ICON)
GUICtrlSetImage ($Exit, "shell32.dll",27)   

GUICtrlCreateLabel ("End User", 18, 100, 100, 100)
GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel ("MIS User", 120, 100, 100, 100)
GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel ("Exit", 235, 100, 100, 100)
GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")

GUISetState()

WHILE 1
      SLEEP (100)
      $msg = GUIGetMsg(0)   
      
      SELECT 
        CASE $msg = $EndUser 
             _EndUser()
             GUISetState(@SW_SHOW)

        CASE $msg = $MISUser
             _MISUser()



        CASE ($msg = $GUI_EVENT_CLOSE ) OR ($msg = $Exit)
             ExitLoop 
             
      ENDSELECT 
    
WEND 



Func _EndUser()
     DriveMapAdd ("X:", "\\192.168.24.7\Stock")
     Run ("X:\arev\STOCK.BAT", "X:\arev")
     SLEEP (3500)
     SEND ("!{ENTER}")      

     GUISetState ($Menu, @SW_HIDE)           
     
     WHILE 1
        IF NOT ProcessExists ("cmd.exe") THEN 
           DriveMapDel ("X:")
           ExitLoop
        ENDIF 
     WEND        
EndFunc 



Func _MISUser()  

     GUICtrlCreateLabel ("Enter Password :", 25, 140, 200, 100)
     GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
     $Input = GUICtrlCreateInput ("", 148, 136, 120, 25, $ES_Password)
     ControlFocus ("", "", $Input)
     GUICtrlSetFont (-1, 12, 1200, -1, "Arial")
     $Cancel = GUICtrlCreateButton ("Cancel", 25, 165, 120, 30)  
     $OK = GUICtrlCreateButton ("OK", 150, 165, 120, 30)
     


     GUISetState()
     
     $msg = GUIGetMsg() 
     SELECT 
        CASE $msg = $Cancel
             MsgBox (0, "", "You've chosen CANCEL !")

     ENDSELECT 
      
      
     
     #cs
     DriveMapAdd ("X:", "\\192.168.24.7\Stock")
     GUISetState ($Menu, @SW_HIDE)           
     Run ("X:\arev\run.BAT", "X:\arev")
     SLEEP (3500)
     SEND ("!{ENTER}")      
     
     WHILE 1
        IF NOT ProcessExists ("cmd.exe") THEN 
           DriveMapDel ("X:")
           ExitLoop
        ENDIF 
     WEND        
     #ce
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

watch the height of the labels, you overlapped controls

#include <GUIConstants.au3>

Opt("TrayIconDebug", 1)


$VERSION = "Stock Take System"
If WinExists($VERSION) Then
   MsgBox(48, "Stock Take System", "Application is already running.....", 3)
   Exit
EndIf

AutoItWinSetTitle($VERSION)



$Menu = GUICreate("The Store - Stock Take System", 300, 200)
; 1st Button
$EndUser = GUICtrlCreateButton("&User", -1, -1, 100, 100, $BS_ICON)
GUICtrlSetImage($EndUser, "shell32.dll", 160)
; 2nd Button
$MISUser = GUICtrlCreateButton("&MIS User", 100, -1, 100, 100, $BS_ICON)
GUICtrlSetImage($MISUser, "shell32.dll", 111)
; 3rd Button
$Exit = GUICtrlCreateButton("E&xit", 200, -1, 100, 100, $BS_ICON)
GUICtrlSetImage($Exit, "shell32.dll", 27)

GUICtrlCreateLabel("End User", 18, 100, 100, 30)
GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel("MIS User", 120, 100, 100, 30)
GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel("Exit", 235, 100, 100, 30)
GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")

GUISetState()

While 1
   $msg = GUIGetMsg()
   
   Select
      Case $msg = $EndUser
         _EndUser()
         GUISetState(@SW_SHOW)
         
      Case $msg = $MISUser
         _MISUser()
         
         
         
      CASE ($msg = $GUI_EVENT_CLOSE) OR ($msg = $Exit)
         ExitLoop
         
   EndSelect
   
WEnd



Func _EndUser()
   DriveMapAdd("X:", "\\192.168.24.7\Stock")
   Run("X:\arev\STOCK.BAT", "X:\arev")
   Sleep(3500)
   Send("!{ENTER}")
   
   GUISetState($Menu, @SW_HIDE)
   
   While 1
      If Not ProcessExists("cmd.exe") Then
         DriveMapDel("X:")
         ExitLoop
      EndIf
   WEnd
EndFunc  ;==>_EndUser



Func _MISUser()
   
   GUICtrlCreateLabel("Enter Password :", 25, 140, 200, 30)
   GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")
   $Input = GUICtrlCreateInput("", 148, 136, 120, 25, $ES_Password)
   ControlFocus("", "", $Input)
   GUICtrlSetFont(-1, 12, 1200, -1, "Arial")
   $Cancel = GUICtrlCreateButton("Cancel", 25, 165, 120, 30)
   $OK = GUICtrlCreateButton("OK", 150, 165, 120, 30)
   
   
   
;~    GUISetState()
   While 1
      $msg2 = GUIGetMsg()
      Select
         Case $msg2 = $Cancel
            MsgBox(0, "", "You've chosen CANCEL !")
            
      EndSelect
      
      
      
      #cs
         DriveMapAdd ("X:", "\\192.168.24.7\Stock")
         GUISetState ($Menu, @SW_HIDE)
         Run ("X:\arev\run.BAT", "X:\arev")
         SLEEP (3500)
         SEND ("!{ENTER}")
         
         WHILE 1
         IF NOT ProcessExists ("cmd.exe") THEN
         DriveMapDel ("X:")
         ExitLoop
         ENDIF
         WEND
      #ce
   WEnd
EndFunc  ;==>_MISUser
Edited by gafrost

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

#3 ·  Posted (edited)

maybe this ?

#include <GUIConstants.au3>

Opt ("TrayIconDebug", 1)


$VERSION = "Stock Take System"
If WinExists($VERSION) Then
   MsgBox(48, "Stock Take System", "Application is already running.....", 3)
   Exit
EndIf

AutoItWinSetTitle($VERSION)



$Menu = GUICreate ("The Store - Stock Take System", 300, 200)
; 1st Button
$EndUser = GUICtrlCreateButton ("&User", -1, -1, 100, 100, $BS_ICON)
GUICtrlSetImage ($EndUser, "shell32.dll",160)
; 2nd Button
$MISUser = GUICtrlCreateButton ("&MIS User", 100, -1, 100, 100, $BS_ICON)
GUICtrlSetImage ($MISUser, "shell32.dll",111)  
; 3rd Button
$Exit = GUICtrlCreateButton ("E&xit", 200, -1, 100, 100, $BS_ICON)
GUICtrlSetImage ($Exit, "shell32.dll",27)  

GUICtrlCreateLabel ("End User", 18, 100, 100, 100)
GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel ("MIS User", 120, 100, 100, 100)
GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel ("Exit", 235, 100, 100, 100)
GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
     GUICtrlCreateLabel ("Enter Password :", 25, 140, 200, 100)
         GUICtrlSetState(-1,$GUI_HIDE)
     GUICtrlSetFont (-1, 10, 1200, -1, "Arial Italic")
     $Input = GUICtrlCreateInput ("", 148, 136, 120, 25, $ES_Password)
     GUICtrlSetState(-1,$GUI_HIDE)
     GUICtrlSetFont (-1, 12, 1200, -1, "Arial")
     $Cancel = GUICtrlCreateButton ("Cancel", 25, 165, 120, 30)
     GUICtrlSetState(-1,$GUI_HIDE)   
     $OK = GUICtrlCreateButton ("OK", 150, 165, 120, 30)
     GUICtrlSetState(-1,$GUI_HIDE)

GUISetState()

WHILE 1
    $msg = GUIGetMsg(0) 
      
      SELECT
        CASE $msg = $EndUser
             _EndUser()
             GUISetState(@SW_SHOW)

        CASE $msg = $MISUser
           GUICtrlSetState($OK,$GUI_SHOW)
           GUICtrlSetState($Input,$GUI_SHOW)
           GUICtrlSetState($Cancel,$GUI_SHOW)
       case $msg = $Cancel
           MsgBox(0,"","you choosen cancel")

        CASE ($msg = $GUI_EVENT_CLOSE ) OR ($msg = $Exit)
             ExitLoop
            
      ENDSELECT
    
WEND



Func _EndUser()
     DriveMapAdd ("X:", "\\192.168.24.7\Stock")
     Run ("X:\arev\STOCK.BAT", "X:\arev")
     SLEEP (3500)
     SEND ("!{ENTER}")      

     GUISetState ($Menu, @SW_HIDE)           
    
     WHILE 1
        IF NOT ProcessExists ("cmd.exe") THEN
           DriveMapDel ("X:")
           ExitLoop
        ENDIF
     WEND           
EndFunc
Edited by rambo3889

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

Thanks gafrost.... it works ! :o

watch the height of the labels, you overlapped controls

#include <GUIConstants.au3>

Opt("TrayIconDebug", 1)
$VERSION = "Stock Take System"
If WinExists($VERSION) Then
   MsgBox(48, "Stock Take System", "Application is already running.....", 3)
   Exit
EndIf

AutoItWinSetTitle($VERSION)
$Menu = GUICreate("The Store - Stock Take System", 300, 200)
; 1st Button
$EndUser = GUICtrlCreateButton("&User", -1, -1, 100, 100, $BS_ICON)
GUICtrlSetImage($EndUser, "shell32.dll", 160)
; 2nd Button
$MISUser = GUICtrlCreateButton("&MIS User", 100, -1, 100, 100, $BS_ICON)
GUICtrlSetImage($MISUser, "shell32.dll", 111)
; 3rd Button
$Exit = GUICtrlCreateButton("E&xit", 200, -1, 100, 100, $BS_ICON)
GUICtrlSetImage($Exit, "shell32.dll", 27)

GUICtrlCreateLabel("End User", 18, 100, 100, 30)
GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel("MIS User", 120, 100, 100, 30)
GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")
GUICtrlCreateLabel("Exit", 235, 100, 100, 30)
GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")

GUISetState()

While 1
   $msg = GUIGetMsg()
   
   Select
      Case $msg = $EndUser
         _EndUser()
         GUISetState(@SW_SHOW)
         
      Case $msg = $MISUser
         _MISUser()
         
         
         
      CASE ($msg = $GUI_EVENT_CLOSE) OR ($msg = $Exit)
         ExitLoop
         
   EndSelect
   
WEnd
Func _EndUser()
   DriveMapAdd("X:", "\\192.168.24.7\Stock")
   Run("X:\arev\STOCK.BAT", "X:\arev")
   Sleep(3500)
   Send("!{ENTER}")
   
   GUISetState($Menu, @SW_HIDE)
   
   While 1
      If Not ProcessExists("cmd.exe") Then
         DriveMapDel("X:")
         ExitLoop
      EndIf
   WEnd
EndFunc ;==>_EndUser
Func _MISUser()
   
   GUICtrlCreateLabel("Enter Password :", 25, 140, 200, 30)
   GUICtrlSetFont(-1, 10, 1200, -1, "Arial Italic")
   $Input = GUICtrlCreateInput("", 148, 136, 120, 25, $ES_Password)
   ControlFocus("", "", $Input)
   GUICtrlSetFont(-1, 12, 1200, -1, "Arial")
   $Cancel = GUICtrlCreateButton("Cancel", 25, 165, 120, 30)
   $OK = GUICtrlCreateButton("OK", 150, 165, 120, 30)
   
   
   
;~    GUISetState()
   While 1
      $msg2 = GUIGetMsg()
      Select
         Case $msg2 = $Cancel
            MsgBox(0, "", "You've chosen CANCEL !")
            
      EndSelect
      
      
      
      #cs
         DriveMapAdd ("X:", "\\192.168.24.7\Stock")
         GUISetState ($Menu, @SW_HIDE)
         Run ("X:\arev\run.BAT", "X:\arev")
         SLEEP (3500)
         SEND ("!{ENTER}")
         
         WHILE 1
         IF NOT ProcessExists ("cmd.exe") THEN
         DriveMapDel ("X:")
         ExitLoop
         ENDIF
         WEND
      #ce
   WEnd
EndFunc ;==>_MISUser

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