Jump to content
Sign in to follow this  
satanttin

iniwrite variable problem

Recommended Posts

satanttin

Alloha,

I have a little problem with saving variables to an .ini file. it works for normal entry's but not for variables i've done it before just forgot how.

the thing is when i save data instead of data it puts numbers in there?

the code for writing data is:

IniWrite("Data Files\CoWorkers.ini", $IName, "Name", $IName)

Hope someone can help me.

Share this post


Link to post
Share on other sites
water

The code you posted uses the same variable for the section name and the content of the key. Is this what you want?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ripdad

That is not a true path.

Where is "Data Files" ?


"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Share this post


Link to post
Share on other sites
water

If you want to write to an Ini file in a subdirectory of the current directory use:

IniWrite(@ScriptDir & "\Data Files\CoWorkers.ini", $IName, "Name", $IName)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
satanttin

The code you posted uses the same variable for the section name and the content of the key. Is this what you want?

yes this is what i want because i need to save more things to each coworker.

@ripdad

 i use ISN autoit studio just the path is correct otherwise i can't even save numbers to it.

Share this post


Link to post
Share on other sites
satanttin

 

If you want to write to an Ini file in a subdirectory of the current directory use:

IniWrite(@ScriptDir & "\Data Files\CoWorkers.ini", $IName, "Name", $IName)

still only gives numbers to the .ini :(

Share this post


Link to post
Share on other sites
water

Can you post a working example? How do you save numbers?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
satanttin

Func AddCoWorker()
IniWrite("Data Files\Coworker.ini", $IName, "Name", $IName)
IniWrite("Data Files\Coworker.ini", $IName, "Department", $Department)
IniWrite("Data Files\Coworker.ini", $IName, "Age", $Age)
GUISetState(@SW_SHOW, $Main)
GUIDelete($AddNew)
EndFunc

This is the function i use to save to the .ini file.

just instead of names it puts a 4 or stuff in it like below:

[4]
Name=4
Department=5
Age=6

Share this post


Link to post
Share on other sites
water

Looks like you write the ControlId and not the content of the Control?

Can you please post all lines of your script where $IName is being used?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
satanttin

$IName = GUICtrlCreateInput("Name",51,4,150,20,-1,512)
the input where i can add coworkers.

IniWrite("Data Files\coworker.ini", $IName, "Name", $IName)
What u already saw.

Global $IName

$GName = $IName
cause i think i need to save the input to another variable to print it somewhere on the screen

Share this post


Link to post
Share on other sites
water

Usually you have a button on the GUI (OK, Start, Save or whatever) to let the script process the users input.

There you read the data of the controls and store it in a variable.

Example:

$sName = GUICtrlRead($IName)

You then need to use this variable to write to the Ini file.

IniWrite("Data Files\Coworker.ini", $sName, "Name", $sName)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
satanttin

ahh that was it xD thanks i think that works ^^ been a while since i used this option didn't remembered u need to use guictrlread :) let u know if it works 

Share this post


Link to post
Share on other sites
satanttin

It works like a charm :) many thanks :3

Share this post


Link to post
Share on other sites
water

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  

×