Sign in to follow this  
Followers 0
Vicks

Ini Question Plus Gui

16 posts in this topic

wouldn't it be great if you could make a script that reads a ini for a GUI, so say you have

blank GUI, then you make a ini telling it were to make the bottons like this

#include <GuiConstants.au3>

GuiCreate("MyGUI", 400, 400,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        If *ini* exist then ini read; reads the ini
    EndSelect
WEnd
 func botton1()
mouseclick("left")
Exit

here is the simple GUI that is blank, but if a ini exists it will read from it and create a botton just say, so say this is the ini

INI

GUICtrlCreateButton1(250, 240)

can it be done?


[s]Autoit[/s]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Yes, it is possable. I wouldent use a ini file though, just a plain text file. It would then kinda turn out like your little scripting language. I can't think of how I could personally use it....

EDIT:

Sorry, you probily want an example....

#include <GuiConstants.au3>

GuiCreate("MyGUI", 400, 400,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
if fileexists("settings.txt") then
$file = fileopen("settings.txt")
$file_ = fileread($file, 0)
$con = stringsplit($file_, "|")
$num = 0
while $num <> $con[0]
if stringinstr($con[$num], "GUICtrlCreateButton") then
$left = StringTrimLeft ( $con[$num], 20 )
$left = StringTrimRight ( $left, 6 )
$right = StringTrimLeft ( $con[$num], 25)
$right = StringTrimRight ( $right, 1 )
GUICtrlCreateButton($left, $right)
endif
$num = $num + 1
wend
endif

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    EndSelect
WEnd
func botton1()
mouseclick("left")
Exit

It doesent really work, but if you change a few things you can make it...

Edited by spyrorocks

Share this post


Link to post
Share on other sites

wow so complicated spyro try this, Just uncomment the Iniwrites to test it out and yeah

#include <GUIConstants.au3>
#include <File.au3>
$file = @ScriptDir & "\config.ini"
;IniWrite($file,"Config","","")
;IniWrite($file,"Config","Left","264")
;IniWrite($file,"Config","Top","176")
;IniWrite($file,"Config","Width","113")
;IniWrite($file,"Config","Height","41")

If Not FileExists($file)Then
_Filecreate($file)
EndIf
If Fileread($file) = "" Then
    Msgbox(0,"Choose","Please Choose Coordinates")
Else
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Button1 = GUICtrlCreateButton("AButton1", IniRead($file,"Config","Left",""), IniRead($file,"Config","Top",""), IniRead($file,"Config","Width",""), IniRead($file,"Config","Height",""))
GUISetState(@SW_SHOW)
EndIf
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

ill explain why I need this, I making a GUI with a skin selecter, and if you select a different skin the bottons aren't going to match up, so I was wondering if I could make a ini that will create the bottons for a certain skin, and yes this works, but I want to know if I make a GUI with a listview if you click on a certain skin name it will read the ini create the bottons to match up with the skin, and switch the skin.


[s]Autoit[/s]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i made skins for *XPClean Menu*

using that same theory

in my sig below ( see forum section )

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thanks, now I have one little problem, is there away to make a GUI the same shape of your picture, I seen that larry made a nice little program but I wouldn't know how to make it look perfect, is there away to make a GUI and set the background invisable except for the actual picture.

this could work

Edited by Vicks

[s]Autoit[/s]

Share this post


Link to post
Share on other sites

thanks, now I have one little problem, is there away to make a GUI the same shape of your picture, I seen that larry made a nice little program but I wouldn't know how to make it look perfect, is there away to make a GUI and set the background invisable except for the actual picture.

That's what Larry's UDF does.

[center]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.[/center]

Share this post


Link to post
Share on other sites

That's what Larry's UDF does.

I know but it would be hard to do something like wouldn't it


[s]Autoit[/s]

Share this post


Link to post
Share on other sites

here ya go....

Opt("GUIONEVENTMODE", 1)
#include <GUIConstants.au3>

;GUI
GUICreate("title", 300, 300, 30, 30, $WS_POPUP, $WS_EX_LAYERED)

$B = GUICtrlCreateButton("Exit", 95, 65, 30, 20, -1, 0x00000020)
GUICtrlSetOnEvent($B, "hello")

If Not FileExists("C:\Temp\Background1.gif") Then MsgBox(0, 0, 0)
$n = GUICtrlCreatePic("C:\Temp\Background1.gif", 0, 0, 500, 500, -1, 0x00000020)
GUISetState(@SW_SHOW)
GUICtrlSetState($B, $GUI_FOCUS)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

While 1
    Sleep(1)
WEnd

Func _exit()
    Exit
EndFunc  ;==>_exit

Func Hello()
    MsgBox(0, "thanks...", "... Valuater", 2)
    Exit
EndFunc  ;==>Hello

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Wow thanks, it still shows the background color tohugh but oh well i can put little messages there

thanks to all of you a good media player coming your way :)

Edited by Vicks

[s]Autoit[/s]

Share this post


Link to post
Share on other sites

#11 ·  Posted

Welcome

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#13 ·  Posted

I me again, from here, I was wondering you know the script you gave me, is there away to get rid of the background color of the GUI, thanks :)

i dont know what you mean... when i chage screens i only see the pic... the background changes to the program or destop....

on my computer... there is no "background" that stays with the pic

Win Xp

dunno?????

8)

PS

Please post on forums... thx


NEWHeader1.png

Share this post


Link to post
Share on other sites

#14 ·  Posted

i dont know what you mean... when i chage screens i only see the pic... the background changes to the program or destop....

on my computer... there is no "background" that stays with the pic

Win Xp

dunno?????

8)

PS

Please post on forums... thx

Opt("GUIONEVENTMODE", 1)
#include <GUIConstants.au3>

;GUI
GUICreate("title", 300, 300, 30, 30, $WS_POPUP, $WS_EX_LAYERED)

$B = GUICtrlCreateButton("Exit", 95, 65, 30, 20, -1, 0x00000020)
GUICtrlSetOnEvent($B, "hello")

If Not FileExists("C:\Documents and Settings\admin\Desktop\New Folder (3)\alien_device.bmp") Then MsgBox(0, 0, 0)
$n = GUICtrlCreatePic("C:\Documents and Settings\admin\Desktop\New Folder (3)\alien_device.bmp", 0, 0, 500, 500, -1, 0x00000020)
GUISetState(@SW_SHOW)
GUICtrlSetState($B, $GUI_FOCUS)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

While 1
    Sleep(1)
WEnd

Func _exit()
    Exit
EndFunc ;==>_exit

Func Hello()
    MsgBox(0, "thanks...", "... Valuater", 2)
    Exit
EndFunc ;==>Hello

I see the picture with white background, Windows XP

thanks


[s]Autoit[/s]

Share this post


Link to post
Share on other sites

#15 ·  Posted

i just noticed you are using a "BMP"

change that to a "GIF"

and you will have what you want

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#16 ·  Posted

ok im using larry's program, I need to know two things please, set background invisable, and make my picture bigger and i should be great from there on :)


[s]Autoit[/s]

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