Sign in to follow this  
Followers 0
NutherNoob

This is hard......

5 posts in this topic

Hello everyone. I've come to a dead end..... For the past few days I've been working on a little project that I hope will:

1. Convert input from a user (hours, mins and secs) into secs (-this is where I came up short)

2. Get mouse click coordinates (and place in Positions group) for each example

3. Wait the converted amount of time (secs) then right click at those coordinates

4. Then loop steps 2 and 3 until all examples are finished.

I stopped at the Convert button for the 1st example coz I simply gave up :)

Could somebody please help? Is there a way to simplify what I've done?? (I want to keep the gui as small as possible)

Thankyou.

#include <GUIConstants.au3>

;master gui vars
    $master_gui_width = 320
    $master_gui_hight = 250
    $gui_master_x_start = 700
    $gui_master_y_start = 120
    
; variables group
    $default_group_width = 230
    $x_var_group = 5
    $y_var_group = 10
    $var_group_width = $default_group_width
    $var_group_hight = $master_gui_hight - 100
;positions vars group   
    $pdefault_group_width = ($master_gui_width - $default_group_width)
    $px_var_group = 237
    $py_var_group = 10
    $pvar_group_width = $pdefault_group_width -10
    $pvar_group_hight = $master_gui_hight - 100
    
; = END DEFINE VARIABLES

; ===== START MASTER GUI
GUICreate("=- Test -=", $master_gui_width, $master_gui_hight , $gui_master_x_start, $gui_master_y_start, -1)
GUISetState (@SW_SHOW)

; MENU 
GuiCtrlCreateMenu("Menu&One")
GuiCtrlCreateMenu("Menu&Two")


GUICtrlCreateGroup ("Times", $x_var_group , $y_var_group , $var_group_width , $var_group_hight)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

GUICtrlCreateGroup ("Positions", $px_var_group , $py_var_group , $pvar_group_width , $pvar_group_hight)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

;Hrs, secs title
$widthCell=100
GUICtrlCreateLabel ("Hrs.  Mins.  Secs.",  50 , 40, $widthCell) 


;SKILLS
;1st eg and pos.
$widthCellb=40
$diff=27

GUICtrlCreateLabel ("Eg 1.",  $x_var_group +2, $y_var_group +$diff*2, $widthCellb) ; 
$hrs1=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*2)-3, 18, 17,$ES_NUMBER) ; hrs
$mins1=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;mins
$secs1=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;secs
$Conv1=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*2)-3, 45, 17) ;convert button
$ttl1=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*2)-3, 40, 17, $ES_NUMBER) ;secsttl
$convsec1=($hrs1/3600)+($mins1/60)+$secs1 ;maths

;2nd eg and pos.
GUICtrlCreateLabel ("Eg 2.",  $x_var_group +2, $y_var_group +$diff*3, $widthCellb) ; 
$hrs2=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ; hrs
$mins2=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;mins
$secs2=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;secs
$Conv2=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*3)-3, 45, 17) ;convert button
$ttl2=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*3)-3, 40, 17, $ES_NUMBER) ;secsttl
$convsec2=($hrs1/3600)+($mins1/60)+$secs1 ;maths

;3rd eg and pos.
GUICtrlCreateLabel ("Eg 3.",  $x_var_group +2, $y_var_group +$diff*4, $widthCellb) ; 
$hrs3=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ; hrs
$mins3=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;mins
$secs3=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;secs
$Conv3=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*4)-3, 45, 17) ;convert button
$ttl3=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*4)-3, 40, 17, $ES_NUMBER) ;secsttl
$convsec3=($hrs1/3600)+($mins1/60)+$secs1 ;maths
;END Egs

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
Case $msg = $Conv1
        GUICtrlRead($convsec1)
        GUICtrlSetData ($ttl1)
          ;;;
    EndSelect
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello everyone. I've come to a dead end..... For the past few days I've been working on a little project that I hope will:

1. Convert input from a user (hours, mins and secs) into secs (-this is where I came up short)

2. Get mouse click coordinates (and place in Positions group) for each example

3. Wait the converted amount of time (secs) then right click at those coordinates

4. Then loop steps 2 and 3 until all examples are finished.

I stopped at the Convert button for the 1st example coz I simply gave up :D

Could somebody please help? Is there a way to simplify what I've done?? (I want to keep the gui as small as possible)

Thankyou.

I fixed your conversions, but i didn't really understand what else you were trying to accomplish, I'd be happy to help more if you would be so kind as to explain.

You really laid out your code... :)

#include <GUIConstants.au3>

;master gui vars
    $master_gui_width = 320
    $master_gui_hight = 250
    $gui_master_x_start = 700
    $gui_master_y_start = 120
   
; variables group
    $default_group_width = 230
    $x_var_group = 5
    $y_var_group = 10
    $var_group_width = $default_group_width
    $var_group_hight = $master_gui_hight - 100
;positions vars group   
    $pdefault_group_width = ($master_gui_width - $default_group_width)
    $px_var_group = 237
    $py_var_group = 10
    $pvar_group_width = $pdefault_group_width -10
    $pvar_group_hight = $master_gui_hight - 100
   
; = END DEFINE VARIABLES

; ===== START MASTER GUI
GUICreate("=- Test -=", $master_gui_width, $master_gui_hight , $gui_master_x_start, $gui_master_y_start, -1)
GUISetState (@SW_SHOW)

; MENU
GuiCtrlCreateMenu("Menu &One")
GuiCtrlCreateMenu("Menu &Two")


GUICtrlCreateGroup ("Times", $x_var_group , $y_var_group , $var_group_width , $var_group_hight)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

GUICtrlCreateGroup ("Positions", $px_var_group , $py_var_group , $pvar_group_width , $pvar_group_hight)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

;Hrs, secs title
$widthCell=100
GUICtrlCreateLabel ("Hrs.  Mins.  Secs.",  50 , 40, $widthCell)


;SKILLS
;1st eg and pos.
$widthCellb=40
$diff=27

GUICtrlCreateLabel ("Eg 1.",  $x_var_group +2, $y_var_group +$diff*2, $widthCellb) ;
$hrs1=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*2)-3, 18, 17,$ES_NUMBER) ; hrs
$mins1=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;mins
$secs1=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;secs
$Conv1=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*2)-3, 45, 17) ;convert button
$ttl1=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*2)-3, 40, 17, $ES_NUMBER) ;secsttl


;2nd eg and pos.
GUICtrlCreateLabel ("Eg 2.",  $x_var_group +2, $y_var_group +$diff*3, $widthCellb) ;
$hrs2=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ; hrs
$mins2=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;mins
$secs2=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;secs
$Conv2=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*3)-3, 45, 17) ;convert button
$ttl2=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*3)-3, 40, 17, $ES_NUMBER) ;secsttl
 ;maths

;3rd eg and pos.
GUICtrlCreateLabel ("Eg 3.",  $x_var_group +2, $y_var_group +$diff*4, $widthCellb) ;
$hrs3=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ; hrs
$mins3=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;mins
$secs3=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;secs
$Conv3=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*4)-3, 45, 17) ;convert button
$ttl3=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*4)-3, 40, 17, $ES_NUMBER) ;secsttl


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Conv1
        $convsec1=(GuiCtrlRead($hrs1)*3600)+(GuiCtrlRead($mins1)*60)+GuiCtrlRead($secs1)
        GUICtrlSetData ($ttl1, $convsec1)
    Case $msg = $Conv2
        $convsec2=(GuiCtrlRead($hrs2)*3600)+(GuiCtrlRead($mins2)*60)+GuiCtrlRead($secs2)
        GUICtrlSetData ($ttl2, $convsec2)
    Case $Msg = $Conv3
        $convsec3=(GuiCtrlRead($hrs3)*3600)+(GuiCtrlRead($mins3)*60)+GuiCtrlRead($secs3)
        GUICtrlSetData ($ttl3, $convsec3)
    EndSelect
WEnd
Edited by Paulie

Share this post


Link to post
Share on other sites

Hey Paulie, thanx!! Works a treat.

Now what I want the script to do is:

1. First of all, bring the window so that its "always on top" (like the Autoit Active Info Window). I've tried WinSetonTop but no joy.

2. Get a userdefined mouseclick and enter the coords, in an input box for each example, in the group labelled "Positions".

3. When the script is run, it will goto the 1st eg.'s coords, right click (choose an option from a menu - I can add this :) ), then count down that eg's converted time (secs). Then it will goto eg. 2 and do the same and keep looping until all eg's are finished.

BTW, couldnt find anything in forums on "always on top".....

Thanx in advance.

#include <GUIConstants.au3>

     WinSetOnTop("=- Test -=", "", 1)
    
;master gui vars
    $master_gui_width = 320
    $master_gui_hight = 250
    $gui_master_x_start = 700
    $gui_master_y_start = 120
   
; variables group
    $default_group_width = 230
    $x_var_group = 5
    $y_var_group = 10
    $var_group_width = $default_group_width
    $var_group_hight = $master_gui_hight - 100
;positions vars group   
    $pdefault_group_width = ($master_gui_width - $default_group_width)
    $px_var_group = 237
    $py_var_group = 10
    $pvar_group_width = $pdefault_group_width -10
    $pvar_group_hight = $master_gui_hight - 100
   
; = END DEFINE VARIABLES

; ===== START MASTER GUI
GUICreate("=- Test -=", $master_gui_width, $master_gui_hight , $gui_master_x_start, $gui_master_y_start, -1)
GUISetState (@SW_SHOW)

; MENU
GuiCtrlCreateMenu("Menu &One")
GuiCtrlCreateMenu("Menu &Two")


GUICtrlCreateGroup ("Times", $x_var_group , $y_var_group , $var_group_width , $var_group_hight)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

GUICtrlCreateGroup ("Positions", $px_var_group , $py_var_group , $pvar_group_width , $pvar_group_hight)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

;Hrs, secs title
$widthCell=100
GUICtrlCreateLabel ("Hrs.  Mins.  Secs.",  50 , 40, $widthCell)


;SKILLS
;1st eg and pos.
$widthCellb=40
$diff=27

GUICtrlCreateLabel ("Eg 1.",  $x_var_group +2, $y_var_group +$diff*2, $widthCellb) ;
$hrs1=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*2)-3, 18, 17,$ES_NUMBER) ; hrs
$mins1=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;mins
$secs1=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*2)-3, 18, 17, $ES_NUMBER) ;secs
$Conv1=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*2)-3, 45, 17) ;convert button
$ttl1=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*2)-3, 40, 17, $ES_NUMBER) ;secsttl
GUICtrlCreateInput ("", 260, ($y_var_group +$diff*2)-3, 45, 17,$ES_NUMBER) ; xy
$xy1=MouseGetPos(MouseClick("left"))

;2nd eg and pos.
GUICtrlCreateLabel ("Eg 2.",  $x_var_group +2, $y_var_group +$diff*3, $widthCellb) ;
$hrs2=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ; hrs
$mins2=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;mins
$secs2=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*3)-3, 18, 17, $ES_NUMBER) ;secs
$Conv2=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*3)-3, 45, 17) ;convert button
$ttl2=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*3)-3, 40, 17, $ES_NUMBER) ;secsttl
 ;maths

;3rd eg and pos.
GUICtrlCreateLabel ("Eg 3.",  $x_var_group +2, $y_var_group +$diff*4, $widthCellb) ;
$hrs3=GUICtrlCreateInput ("", 50, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ; hrs
$mins3=GUICtrlCreateInput ("", 79, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;mins
$secs3=GUICtrlCreateInput ("", 108, ($y_var_group +$diff*4)-3, 18, 17, $ES_NUMBER) ;secs
$Conv3=GUICtrlCreateButton ("Convert", 137, ($y_var_group +$diff*4)-3, 45, 17) ;convert button
$ttl3=GUICtrlCreateInput ("", 190, ($y_var_group +$diff*4)-3, 40, 17, $ES_NUMBER) ;secsttl


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Conv1
        $convsec1=(GuiCtrlRead($hrs1)*3600)+(GuiCtrlRead($mins1)*60)+GuiCtrlRead($secs1)
        GUICtrlSetData ($ttl1, $convsec1)
    Case $msg = $Conv2
        $convsec2=(GuiCtrlRead($hrs2)*3600)+(GuiCtrlRead($mins2)*60)+GuiCtrlRead($secs2)
        GUICtrlSetData ($ttl2, $convsec2)
    Case $Msg = $Conv3
        $convsec3=(GuiCtrlRead($hrs3)*3600)+(GuiCtrlRead($mins3)*60)+GuiCtrlRead($secs3)
        GUICtrlSetData ($ttl3, $convsec3)
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

remove this

GUISetState (@SW_SHOW)

and move this

WinSetOnTop("=- Test -=", "", 1)

below this

GuiSetState()

like this

GuiSetState()

WinSetOnTop("=- Test -=", "", 1)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thanx Valuater, that got my window to stay on top. Funny tho, I tried your piece of script for 10mins with no luck, so I rebooted and presto!!

Now how to try the rest..... Back soon

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