Sign in to follow this  
Followers 0
tcb

use csv as source of variable

7 posts in this topic

I am trying to get autoit to pull a series of files from a webserver.

I have a script which prompts the user for their userid and password, captures those pieces of information and then subsequently uses that information for the rest of the script.

I now want to update the script to get the userid and password from a csv file.

Could anyone point me in the right direction?

the initial script is below

$SXUSERNAME = InputBox(4, "User name", "please enter your username including domain")

$SXPASSWORD = InputBox(4, "Password", "please enter your password")

Global $SVRLOCATION = String("http://192.168.65.123/api/dav/Calendars/Users/")

Global $SXUN = $SXUSERNAME

Global $CAL = String("/Calendar")

Global $WGET = String("C:\PF\GnuWin32\bin\wget --http-user=")

Global $HTTPP = String(" --http-password=")

Global $A1 = String(" \ --secure-protocol=auto --no-check-certificate --recursive \ --no-directories -P ")

Global $FEXLOC = String("c:\calendars\NEWTEST\"&$SXUSERNAME)

Global $L1 = String(" --level=1 \ ")

Dim $URL = $SVRLOCATION&$SXUN&$CAL

Dim $sCDOS1 = $WGET&$SXUSERNAME&$HTTPP&$SXPASSWORD&$A1&$FEXLOC&$L1&$URL

MsgBox(0,"TEST",$URL)

MsgBox(0,"WGET",$sCDOS1)

ClipPut($sCDOS1)

#include <Process.au3>

$rc = _RunDOS ( $sCDOS1 )

This script as is works fine but I want to add the extra layer as described on top. I guess I will need a loop to work though the csv as well.

Thanks

Tony

Share this post


Link to post
Share on other sites



Check out the INI functions in the help file.

Also you may want to encrypt the user and pass in the INI file with the encryption functions available.

Share this post


Link to post
Share on other sites

thanks but I am not sure how ini helps. would I have to generate the ini file with unique keys in username and password sections so something like

username section

key = username 1

key = username 2

password section

key = userpass 1

key = userpass 2

thanks

Share this post


Link to post
Share on other sites

Yes , you can even generate it using IniWriteSection and IniWrite.

Of course having more then 100 users would make using csv file and ADODB connection

more suitable.

Share this post


Link to post
Share on other sites

thanks once again. more than likely to ultimately have more than 100 users....

Share this post


Link to post
Share on other sites

You can buy yourself a bit more "security" by storing the hash of user & password & salt instead of storing actual data yourself.

Then if you have a significant number of users in the near future, use an encrypted SQLite database. All embedded, up to date and no need to rely on third-party software being installed (or having to install it).


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

i should explain that at this stage security is not a concern. the script will be run as an admin. the admin will be required to build the csv with username/password.

ultimate goal is to have script read username/password from file, use those details to perform wget against server, then continue to next name in list until end.

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