Solved

VBS Script

Posted on 2014-07-17
6
187 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
Comment Utility
Found some INI reading and writing functions that made this a lot easier.

vbs attached
eComm.vbs
0
 
LVL 51

Assisted Solution

by:Bill Prew
Bill Prew earned 333 total points
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 51

Assisted Solution

by:Bill Prew
Bill Prew earned 333 total points
Comment Utility
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
Comment Utility
Thanks much for the assistance!!
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
Welcome, glad that was useful.

~bp
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

8 Experts available now in Live!

Get 1:1 Help Now