Sign in to follow this  
Followers 0
keen

Not Working

13 posts in this topic

Can you guys help me figure out why the file writing isn't working? Thanks in advance! :P

Here is the script:

#include <GUIConstants.au3>
#include <File.au3>

FileWrite("c:/blank.txt", "")
Global $oRP


$Form2 = GUICreate("Vault - Version 1.0.0", 1002, 727, 149, 114)
GUISetBkColor(0xFFFFFF)
$Pic1 = GUICtrlCreatePic("S:\My Documents\JORDANS STUFF\Vault - Mrs. Johnsons Program\Graphics Files\Main-Image.gif", 104, 0, 753, 153, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetBkColor(0xFFFFFF)

$Button1 = GUICtrlCreateButton("Admin Login", 850, 10, 81, 25, 0)

GUICtrlCreateTab(10, 170, 975, 547)
GUISetBkColor(0xFFFFFF)
$Date1 = GUICtrlCreateDate("2006/12/15 18:30:1", 32, 680, 233, 24)
$TabSheet2 = GUICtrlCreateTabItem("Check Out")
$Label1 = GUICtrlCreateLabel("Welcome to the checkout system. Please fill out the information at the bottom of the screen to check a book out.", 14, 237, 966, 20, $SS_CENTER)
$Group1 = GUICtrlCreateGroup("Check Out", 64, 320, 857, 337)
$Input1 = GUICtrlCreateInput("", 248, 368, 241, 24)
$Label2 = GUICtrlCreateLabel("Your Name (First And Last)", 80, 368, 163, 20)
$Label3 = GUICtrlCreateLabel("Class Period:", 80, 416, 84, 20)
$Input2 = GUICtrlCreateInput("", 168, 416, 17, 24)
$Label4 = GUICtrlCreateLabel("Name Of Book:", 232, 416, 95, 20)
$Input3 = GUICtrlCreateInput("", 336, 416, 241, 24)
$Label5 = GUICtrlCreateLabel("Date Checked Out:", 624, 416, 116, 20)
$Input4 = GUICtrlCreateInput("", 744, 416, 145, 24)
$Button2 = GUICtrlCreateButton("Log Data", 424, 576, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("Returning Books")
GUICtrlCreateTabItem("")


GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button2
            _FileWriteLog(@ScriptDir & "CheckedOut.ini",$Input1&$Input2&$Input3&$Input4)
            GUICtrlSetData ($Input1&$Input2&$Input3&$Input4, "")
            

    EndSwitch
WEnd

[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites



Can you please tell me what is wrong with that part? Thanks! :P


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites

Can you please tell me what is wrong with that part? Thanks! :P

Yours doesn't have a backslash before CheckedOut.ini. As a result, autoit sees this:

C:\documents and settings\desktopCheckedOut.ini

which is wrong since it would be this:

C:\documents and settings\desktop\CheckedOut.ini

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

It still isnt logging It.


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites

Can you please tell me what is wrong with that part? Thanks! :P

I think there are a few things wrong with your script. The bit Gary posted was a correction to one bit where you had omitted '\'.

Near the start you have

FileWrite("c:/blank.txt", "") ; should this be FileWrite("c:\bla......

Near the end you have

_FileWriteLog(@ScriptDir & "CheckedOut.ini",$Input1&$Input2&$Input3&$Input4)

but I imagine you want to write the contents of the edits, so you need

_FileWriteLog(@ScriptDir & "\CheckedOut.ini",guictrlreaddata($Input1) & ' ' & guictrlreaddata($Input2) ....etc

Then you have

GUICtrlSetData ($Input1&$Input2&$Input3&$Input4, "")

This needs to be

Guictrlsetdata($Input1,"")

Guictrlsetdata($Input2,"")

.

etc


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Excuse me, i didn't see what the input variables were, they are just the control id's. I didn't realize they didn't contain data:

Case $msg = $Button2
            _FileWriteLog(@ScriptDir & "CheckedOut.ini",GUICTrlRead($Input1)&GUICTrlRead($Input2)&GUICTrlRead($Input3)&GUICTrlRead($Input4))
            GUICtrlSetData ($Input1,"")
            GUICtrlSetData ($Input2,"")
            GUICtrlSetData ($Input3,"")
            GUICtrlSetData($Input4, "")

Try that.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Excuse me, i didn't see what the input variables were, they are just the control id's. I didn't realize they didn't contain data:

Case $msg = $Button2
            _FileWriteLog(@ScriptDir & "CheckedOut.ini",GUICTrlRead($Input1)&GUICTrlRead($Input2)&GUICTrlRead($Input3)&GUICTrlRead($Input4))
            GUICtrlSetData ($Input1,"")
            GUICtrlSetData ($Input2,"")
            GUICtrlSetData ($Input3,"")
            GUICtrlSetData($Input4, "")

Try that.

There's an amazing echo in here!

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Not it wont let my type :P


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites

Not it wont let my type :P

Show us your latest script.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Here you go :P

#include <GUIConstants.au3>
#include <File.au3>

FileWrite("c:/blank.txt", "")
Global $oRP


$Form2 = GUICreate("Vault - Version 1.0.0", 1002, 727, 149, 114)
GUISetBkColor(0xFFFFFF)
$Pic1 = GUICtrlCreatePic("S:\My Documents\JORDANS STUFF\Vault - Mrs. Johnsons Program\Graphics Files\Main-Image.gif", 104, 0, 753, 153, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetBkColor(0xFFFFFF)

$Button1 = GUICtrlCreateButton("Admin Login", 850, 10, 81, 25, 0)

GUICtrlCreateTab(10, 170, 975, 547)
GUISetBkColor(0xFFFFFF)
$Date1 = GUICtrlCreateDate("2006/12/15 18:30:1", 32, 680, 233, 24)
$TabSheet2 = GUICtrlCreateTabItem("Check Out")
$Label1 = GUICtrlCreateLabel("Welcome to the checkout system. Please fill out the information at the bottom of the screen to check a book out.", 14, 237, 966, 20, $SS_CENTER)
$Group1 = GUICtrlCreateGroup("Check Out", 64, 320, 857, 337)
$Input1 = GUICtrlCreateInput("", 248, 368, 241, 24)
$Label2 = GUICtrlCreateLabel("Your Name (First And Last)", 80, 368, 163, 20)
$Label3 = GUICtrlCreateLabel("Class Period:", 80, 416, 84, 20)
$Input2 = GUICtrlCreateInput("", 168, 416, 17, 24)
$Label4 = GUICtrlCreateLabel("Name Of Book:", 232, 416, 95, 20)
$Input3 = GUICtrlCreateInput("", 336, 416, 241, 24)
$Label5 = GUICtrlCreateLabel("Date Checked Out:", 624, 416, 116, 20)
$Input4 = GUICtrlCreateInput("", 744, 416, 145, 24)
$Button2 = GUICtrlCreateButton("Log Data", 424, 576, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("Returning Books")
GUICtrlCreateTabItem("")


GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button2
            _FileWriteLog(@ScriptDir & "CheckedOut.ini",GUICTrlRead($Input1)&GUICTrlRead($Input2)&GUICTrlRead($Input3)&GUICTrlRead($Input4))
            GUICtrlSetData ($Input1,"")
            GUICtrlSetData ($Input2,"")
            GUICtrlSetData ($Input3,"")
            GUICtrlSetData($Input4, "")
    EndSwitch
WEnd

[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#include <File.au3>

FileWrite("c:/blank.txt", "")
Global $oRP


$Form2 = GUICreate("Vault - Version 1.0.0", 1002, 727, 149, 114)
GUISetBkColor(0xFFFFFF)
$Pic1 = GUICtrlCreatePic("S:\My Documents\JORDANS STUFF\Vault - Mrs. Johnsons Program\Graphics Files\Main-Image.gif", 104, 0, 753, 153, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetBkColor(0xFFFFFF)

$Button1 = GUICtrlCreateButton("Admin Login", 850, 10, 81, 25, 0)

GUICtrlCreateTab(10, 170, 975, 547)
GUISetBkColor(0xFFFFFF)
$Date1 = GUICtrlCreateDate("2006/12/15 18:30:1", 32, 680, 233, 24)
$TabSheet2 = GUICtrlCreateTabItem("Check Out")
$Label1 = GUICtrlCreateLabel("Welcome to the checkout system. Please fill out the information at the bottom of the screen to check a book out.", 14, 237, 966, 20, $SS_CENTER)
$Group1 = GUICtrlCreateGroup("Check Out", 64, 320, 857, 337)
$Input1 = GUICtrlCreateInput("", 248, 368, 241, 24)
$Label2 = GUICtrlCreateLabel("Your Name (First And Last)", 80, 368, 163, 20)
$Label3 = GUICtrlCreateLabel("Class Period:", 80, 416, 84, 20)
$Input2 = GUICtrlCreateInput("", 168, 416, 17, 24)
$Label4 = GUICtrlCreateLabel("Name Of Book:", 232, 416, 95, 20)
$Input3 = GUICtrlCreateInput("", 336, 416, 241, 24)
$Label5 = GUICtrlCreateLabel("Date Checked Out:", 624, 416, 116, 20)
$Input4 = GUICtrlCreateInput("", 744, 416, 145, 24)
$Button2 = GUICtrlCreateButton("Log Data", 424, 576, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("Returning Books")
GUICtrlCreateTabItem("")


GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            _FileWriteLog(@ScriptDir & "\CheckedOut.ini",GUICTrlRead($Input1)&GUICTrlRead($Input2)&GUICTrlRead($Input3)&GUICTrlRead($Input4))
            GUICtrlSetData ($Input1,"")
            GUICtrlSetData ($Input2,"")
            GUICtrlSetData ($Input3,"")
            GUICtrlSetData ($Input4, "")
    EndSwitch
WEnd

There, you hadn't placed the backslash before CheckedOut.ini. Also, you had this:

Case $msg = $Button2

That will always be true when using a switch, you would use that in a select case. So i changed it to this:

Case $Button2

There's an amazing echo in here!

The hostility.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

The hostility.

No offence intended. I should have said 'great minds..'

Goodnight, it's time for bed for me.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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