Solved

VBS Script

Posted on 2014-07-17
6
190 Views
Last Modified: 2014-07-18
The eComm.vbs script is designed to read the 'FloorLimits_On.txt and update the interac.ini file with these values:

REWARDS_FLOOR_LIMIT=2001
DOLLAR_OFF_FLOOR_LIMIT=2501

Before the script is applied these values show as:

REWARDS_FLOOR_LIMIT=0
DOLLAR_OFF_FLOOR_LIMIT=0

When the script is applied the file is being updated but I need it to overwrite those lines with the new values.   any idea how I can do this?

See attached interac1.ini file to see how values are being updated after script is applied.
interac1.ini
eComm.vbs
FloorLimit-On.txt
0
Comment
Question by:SDJ_1
  • 3
  • 2
6 Comments
 
LVL 12

Accepted Solution

by:
Jeff Darling earned 167 total points
ID: 40203394
Found some INI reading and writing functions that made this a lot easier.

vbs attached
eComm.vbs
0
 
LVL 53

Assisted Solution

by:Bill Prew
Bill Prew earned 333 total points
ID: 40203562
Those INI support function shown above can be very useful, here's a couple of prior questions that also demonstrate their usage.

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_26661747.html

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28276498.html

~bp
0
 

Author Comment

by:SDJ_1
ID: 40204373
Thanks guys for assistance. @ Jeff Darling script you submitted is working perfectly.   The script is designed to read the values from the .txt file and add that value to the INI file,  The client wants to be able to change that value in the .txt file back to zero if needed.   I created another txt file with values back to zero ran script and getting message that the interac update has already been applied, can you tell me why this is happening when the .txt file is updated with values back to zero.

REWARDS_FLOOR_LIMIT=0
DOLLAR_OFF_FLOOR_LIMIT=0
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 53

Assisted Solution

by:Bill Prew
Bill Prew earned 333 total points
ID: 40204385
The code currently just adds to the INI if that key is not there currently.  Since you want to always add or update the INI with the value even if it's there, I believe you could change this block:

' see if what was read from FloorLimits_On.txt is already contained in interac.ini   
strCurrentValue = ReadIni(g_contInter, "", strNewKey)
		
If InStr(1,strCurrentValue, strNewValue, vbTextCompare) = 0 Then
	Call WriteToLog("Interac update being applied.", False)
	WriteIni g_contInter, "", strNewKey, strNewValue
Else   
	Call WriteToLog("Interac update has already been applied.", False)
End If

Open in new window

to:

' insert/update what was read from FloorLimits_On.txt into interac.ini   
WriteIni g_contInter, "", strNewKey, strNewValue

Open in new window

~bp
0
 

Author Comment

by:SDJ_1
ID: 40204426
Thanks much for the assistance!!
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 40204468
Welcome, glad that was useful.

~bp
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question