Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently November 1st, 2024, 5:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Log File
PostPosted: June 12th, 2007, 10:36 pm 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Hello fellow Opus users. Am totally brand new to Opus and the scripting and am needing help. I have done a publication which I want to record how many times a button has been pressed so I know how many times used. I am wanting to write the counter inn the style of like below:

Clientname1=0000
Clientname2=0000
Clientname3=0000

When pressing the buttons I would change the Clientname variable to whatever it is and then want to search through the list in the log.txt file until I find the Clientname the same as the variable. If the Clientname is not in the log.txt file then just add it to the bottom in the same format. Then increase the counter by one so eventually getting the totals.

Sounds simple enough and can do in other appoications but wanting to keep it in Opus so all tidy byt as totally new with the Opus scripting systax am a little lost where to start. Can someone please show me the way to go with this or even do a simple script which I can look at. Thanks to you all and look forward to helping others eventually - may take some time mind you.

I am using the new Opus Pro 6

Regards
Anthony


Top
 Profile  
 
 Post subject:
PostPosted: June 13th, 2007, 10:20 am 
Offline

Joined: January 19th, 2005, 5:15 pm
Posts: 83
Location: Netherlands
I would use the SetINIFileData for that.

The next function will create a file if not existing, and set the value of choice one higher.

Code:
// call function
addToLog('test');

// Function counts 1 to logfile value
function addToLog(key)
{
   logFile    = 'C:\\test.log'
   logSection   = 'LOG'
   curValue    = GetINIFileData(logFile, logSection, key)   
   newValue   = String.integer(curValue) + 1
   succes       = SetINIFileData(logFile, logSection, key,newValue)
   if( !succes)    Debug.trace('addToLog() :: Set log value not succesful for key '+key)
   else           Debug.trace('addToLog() :: new value = '+newValue)
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group