Jump to content

how to pass content with in file as a parameter


chandan029

Recommended Posts

Hi all, I have to pass the username and password stored in of the .txt file in my system to the autoit file. i m tryin to automate gmail. i dont want to store it directly as a variable within . iI there any way to pass these information directly or a way by which i can pass the content of my file as a variable to autoit and then use it...

Thanx.

Link to comment
Share on other sites


Hi,

An ini file is a txt file that is structured to get and/or store information easily so I would be recommending that method to you unless you have special needs.

example code


; ini file name to use
$file_ini = 'my program settings.ini'

; create ini file if not exists
If Not FileExists($file_ini) Then
IniWrite($file_ini, 'gmail', 'username', '')
IniWrite($file_ini, 'gmail', 'password', '')
EndIf

; read ini file values form gmail section
$username = IniRead($file_ini, 'gmail', 'username', '')
$password = IniRead($file_ini, 'gmail', 'password', '')

; show result
MsgBox(0, Default, '$username = ' & $username & @CRLF & '$password = ' & $password)

; example of checking for non empty values for both values
If $username <> '' And $password <> '' Then
MsgBox(0, Default, 'both variables have values worth using')
EndIf

Link to comment
Share on other sites

  • 2 weeks later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...