?
Solved

VBS Script

Posted on 2014-07-17
6
Medium Priority
?
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 13

Accepted Solution

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

vbs attached
eComm.vbs
0
 
LVL 57

Assisted Solution

by:Bill Prew
Bill Prew earned 1332 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 57

Assisted Solution

by:Bill Prew
Bill Prew earned 1332 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 57

Expert Comment

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

~bp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 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