Sign in to follow this  
Followers 0
huldu

A question about GUICtrlCreateInput and IniWrite

2 posts in this topic

Hey!

Ive tried get this script to work, but it only shows up a "3" in the .ini! I just cant figure out what is wrong... :P

Maybe theres something different to be used when making a GUI then just normal code?

#include <GUIConstants.au3>

GUICreate(" My GUI input acceptfile", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES

$file = GUICtrlCreateInput ( "", 10, 5, 300, 20)

$btn = GUICtrlCreateButton ("Ok", 40, 75, 60, 20)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $btn

exitloop

EndSelect

Wend

IniWrite("c:\saved.ini", "Test2", "Test2", $file)

MsgBox (4096, "drag drop file", GUICtrlRead($file))

Maybe someone knows what is wrong :|, no matter what i write the .ini always get a "3" in the Test2 key.


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites



Try

#include <GUIConstants.au3>

GUICreate(" My GUI input acceptfile", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES
$file = GUICtrlCreateInput ( "", 10, 5, 300, 20)
$btn = GUICtrlCreateButton ("Ok", 40, 75, 60, 20)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
Select
Case $msg = $btn
exitloop
EndSelect
Wend

IniWrite("c:\saved.ini", "Test2", "Test2", GUICtrlRead($file))

MsgBox (4096, "drag drop file", GUICtrlRead($file))

You need to use GUICtrlRead to get the value of $file instead of the ControlID



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

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