Solved

VBS Script

Posted on 2014-07-17
6
188 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 52

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 52

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 52

Expert Comment

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

~bp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now