Jump to content

Saving GUI info external


FMS
 Share

Recommended Posts

Dear reader,

 

At the moment I'm trying to make a script that is changeble by the users.
It is a script that type's words for you whish u can change what it should be.
I was thinking that the users may change the button settings in the second tab whit a pull down menu.
 

At this point the text that must be typed in are hard coded in the program.
I know that I must "save" the text in a diffrent file but i don't now how.
Also mine search on the net or forum wasn't fruitfull.(maybe i was looking wrong;))

Could somebody push me in the right direction?
(I'm still al little bit new at this so any help or info is appreciated)

 

thanks in advanced.

 

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 318, 228, 192, 124)

$Tab1 = GUICtrlCreateTab(8, 32, 289, 177)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Btn001 = GUICtrlCreateButton("Button1", 25, 68, 75, 25)
$Btn002 = GUICtrlCreateButton("Button2", 110, 68, 75, 25)
$Btn003 = GUICtrlCreateButton("Button3", 196, 68, 75, 25)
$Btn004 = GUICtrlCreateButton("Button4", 25, 100, 75, 25)
$Btn005 = GUICtrlCreateButton("Button5", 110, 100, 75, 25)
$Btn006 = GUICtrlCreateButton("Button6", 196, 100, 75, 25)
$Btn007 = GUICtrlCreateButton("Button7", 25, 132, 75, 25)
$Btn008 = GUICtrlCreateButton("Button8", 110, 132, 75, 25)
$Btn009 = GUICtrlCreateButton("Button9", 196, 132, 75, 25)
$Btn010 = GUICtrlCreateButton("Button10", 25, 164, 75, 25)
$Btn011 = GUICtrlCreateButton("Button11", 110, 164, 75, 25)
$Btn012 = GUICtrlCreateButton("Button12", 196, 164, 75, 25)

$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$Combo1 = GUICtrlCreateCombo("", 144, 72, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, " 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12")
$Btn013 = GUICtrlCreateButton("Button13", 40, 168, 75, 25)
$Btn014 = GUICtrlCreateButton("Button14", 152, 168, 75, 25)

GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Btn001
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 1 is pushed")
         Case $Btn002
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 2 is pushed")
         Case $Btn003
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 3 is pushed")
         Case $Btn004
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 4 is pushed")
         Case $Btn005
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 5 is pushed")
         Case $Btn006
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 6 is pushed")
         Case $Btn007
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 7 is pushed")
         Case $Btn008
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 8 is pushed")
         Case $Btn009
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 9 is pushed")
         Case $Btn010
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 10 is pushed")
         Case $Btn011
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 11 is pushed")
         Case $Btn012
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 12 is pushed")
         Case $Btn013
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 13 is pushed")
         Case $Btn014
            send("{ALTDOWN}{TAB}{ALTUP}")
            Sleep(1000)
            Send ("Button 14 is pushed")
    EndSwitch
WEnd

 

as finishing touch god created the dutch

Link to comment
Share on other sites

Not sure why you are sending your ALT and TAB commands, but you could reduce your code by using a function.

Global $altab

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Btn001
            SendAltTabCommands(1)
         Case $Btn002
            SendAltTabCommands(2)
         Case $Btn003
            SendAltTabCommands(3)
         Case $Btn004
            SendAltTabCommands(4)
         Case $Btn005
            SendAltTabCommands(5)
         Case $Btn006
            SendAltTabCommands(6)
         Case $Btn007
            SendAltTabCommands(7)
         Case $Btn008
            SendAltTabCommands(8)
         Case $Btn009
            SendAltTabCommands(9)
         Case $Btn010
            SendAltTabCommands(10)
         Case $Btn011
            SendAltTabCommands(11)
         Case $Btn012
            SendAltTabCommands(12)
         Case $Btn013
            SendAltTabCommands(13)
         Case $Btn014
            SendAltTabCommands(14)
    EndSwitch
WEnd

Func SendAltTabCommands($altab)
    send("{ALTDOWN}{TAB}{ALTUP}")
    Sleep(1000)
    Send ("Button " & $altab & " is pushed")
EndFunc

 

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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

×
×
  • Create New...