Solved

VBS Script

Posted on 2014-07-17
6
189 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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