variable.

Help each other out

variable.

Postby epitaph on Mon May 15, 2006 6:01 pm

Is it possible to do a variable unset or delete specific variables throughout a whole database? i cant figure it out.. i need to delete the variables "flag" and "flagged" throughout the database "movies" with the click of a button. whats the best way?
epitaph
 
Posts: 58
Joined: Wed Apr 19, 2006 8:28 am

Postby m_ski on Tue May 16, 2006 11:39 am

I don't think there is an easy way with xlobby events.
Probably the easiest would be to use Xscript or vbscript and write a bit of code that removes all lines that contain <flag> from the raw xml file, then refresh the database. Should be fairly easy actually.
If you don't know how to do this then paste a bit of the xml file showing the bits you want removed from the file and I'll have a look at writing a short script for you.

Do you use dvdprofiler or is it a database just created in xlobby?
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby epitaph on Tue May 16, 2006 4:34 pm

I use DVD profiler, i need 2 lines deleted from every movie profile if it exists.. 1 looks just like

<flag>Here is the display name of the movie</flag>

and the other line is.

<flagged>//skin:/buttons/name of image to display when flagged.png<flagged>

is this what you need? that would be awesome if you could do that for me!
epitaph
 
Posts: 58
Joined: Wed Apr 19, 2006 8:28 am

Postby m_ski on Wed May 17, 2006 11:34 am

You need to do a bit of a test first to see if it will work.

- Open up the xml file in notepad and delete the 'flag' lines from one of your movies.
- Save the xml file
- Do a movies refresh - hopefully this will load the xml file into xlobby before it does the refresh from dvdprofiler.
If the 'flag' stuff has been deleted successfully then my method will work - let me know and I'll knock it up for you.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby epitaph on Wed May 17, 2006 5:55 pm

by movies refresh you mean reload the movies database?

i deleted flagged lines opened xlobby imported movies database and flagged lines were no longer there. is this what you needed?
epitaph
 
Posts: 58
Joined: Wed Apr 19, 2006 8:28 am

Postby m_ski on Thu May 18, 2006 11:57 am

Ok here is a script to try...

Paste the following into a text file and save it as xmlremovenodes.vbs

Code: Select all
'xmlRemoveNodes
'Reads a text file in and deletes any lines containing the searchstring
'Run it using the cscript command...
'
'Usage:
'cscript xmlRemoveNodes.vbs <origfile> <newfile> <searchstring>
'
'If you want to delete an xml node then searchstring should be of the form "<nodename>" (inc. quotes)
'e.g. cscript xmlRemoveNodes.vbs "orig.xml" "new.xml" "<xmlnode>"
'
' by m_ski on xlobby.com
' 18th May 2006

Option Explicit
'On Error Resume Next

Dim objFSO
Dim objFromFile
Dim objToFile
Dim strLine
Dim commandLineArgs
Dim FromFile
Dim ToFile
Dim searchstring

wscript.echo "xmlRemoveNodes - by m_ski on xlobby.com"
wscript.echo "Usage: cscript xmlremoveNodes <origfile> <newfile> <searchstring>"
wscript.echo "e.g. cscript xmlRemoveNodes.vbs " & chr(34) & "orig.xml" & chr(34) & _
" " & chr(34) & "new.xml" & chr(34) & " " & chr(34) & "<xmlnode>" & chr(34)
'

' Get command line arguments
set commandLineArgs = WScript.Arguments

if commandLineArgs.length = 3 then

   FromFile = commandLineArgs(0)
   ToFile = commandLineArgs(1)
   searchstring = commandLineArgs(2)

   Const ForReading = 1
   Const ForWriting = 2

   Set objFSO = CreateObject("Scripting.FileSystemObject")   
   Set objFromFile = objFSO.OpenTextFile(FromFile, ForReading)
   Set objToFile = objFSO.OpenTextFile(ToFile, ForWriting, True)

   Do While objFromFile.AtEndOfStream = False
        'read a line from the file
        strLine = objFromFile.ReadLine
   
        'Check if it contains the seacrh string
        if InStr(strLine,searchstring) <> 0 then
         'searchstring found so do not copy this line
         wscript.echo "Deleted Line: " & strLine
        else
           'line does not contain searchstring so copy this line to the new file
         objToFile.WriteLine strLine
        end if
   Loop

   objFromFile.Close
   objToFile.Close
   Set objFromFile = Nothing
   Set objToFile = Nothing
else
   wscript.echo "Incorrect usage - must be 3 arguments"
end if


This script will take in a xlobby xml database file and output a new one omitting any lines containing the searchstring specified.

After the script has created the new file you will have to rename the old one to something else and rename the new one to the name of the original file, and then refresh the database. This can all be done automatically with an xlobby event.

Syntax is;
Code: Select all
cscript xmlremovenodes.vbs <orig file> <new file> <variable to remove>


I advise you to surround each argument in quotes and specify the xmlnode like this - "<flag>".

Let me know if it works OK.
Last edited by m_ski on Mon Oct 16, 2006 8:53 am, edited 1 time in total.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby epitaph on Thu May 18, 2006 4:00 pm

sorry i am new to the scripting.. where to i put the actual script file and where to i type the code "cscript xmlremovenodes.vbs <orig file> <new file> <variable to remove>"?
epitaph
 
Posts: 58
Joined: Wed Apr 19, 2006 8:28 am

Postby m_ski on Fri May 19, 2006 11:34 am

Test it from the command prompt first.
Copy the script to wherever you want really (maybe xlobby\scripts)

Start>Run : then type 'Cmd'

Type
Code: Select all
cscript <full path to vbs file inc. extension> <orig file> <new file> <var to remove>

<orig file> and <new file> shound contain a full path.

Once you have confirmed this works OK then you can create an xlobby event (OS>execute file). File=cscript, Arguments = <full path to vbs file inc. extension> <orig file> <new file> <var to remove>. You can use window type=hidden in order that nothing is displayed on screen while this is occuring. You will also have to to a file rename in the same way, and then a category refresh.

Hope this is enough info.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby smarty on Thu Sep 14, 2006 7:56 pm

m_ski,
I tried out your script and it works like a champ to delete a specifiec database field entry that matches the search text of the script.


I am using Lasse's CallerID plugin (very nice BTW), and was wondering if your script could be adapted so that the CID database could be deleted (entry by entry as needed).

The script would have to be modified so that the search text was the date/time of a given call, and your VBS script could then delete the WHOLE RECORD where the field search text matched. Since the search would be based on date/time, only the single call record would be deleted (if the script could do this).

It would sure be nice if Xlobby had other options for database modification.
smarty
 
Posts: 179
Joined: Thu Jul 27, 2006 12:04 am
Location: San Antonio, TX USA

Postby m_ski on Fri Sep 15, 2006 12:01 pm

I am not familiar with the CallerID plugin but I assume it creates a standard xlobby database with the call log in it. If it does then I think you could achieve what you want with built-in xlobby events by filtering the category and then deleteing the current item. Search for 'filter' on the forum if you don't know how.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby lar282 on Fri Sep 15, 2006 12:17 pm

smarty wrote:m_ski,
I tried out your script and it works like a champ to delete a specifiec database field entry that matches the search text of the script.


I am using Lasse's CallerID plugin (very nice BTW), and was wondering if your script could be adapted so that the CID database could be deleted (entry by entry as needed).

The script would have to be modified so that the search text was the date/time of a given call, and your VBS script could then delete the WHOLE RECORD where the field search text matched. Since the search would be based on date/time, only the single call record would be deleted (if the script could do this).

It would sure be nice if Xlobby had other options for database modification.


Maybe its easier if I do it straight from the plugin? What exactly are u trying to do?

//Lasse
lar282
 
Posts: 1624
Joined: Thu Apr 01, 2004 4:13 pm
Location: Helsingborg, Sweden

Postby smarty on Fri Sep 15, 2006 2:07 pm

Lasse,
Your CallerID plugin displays VERY NICE on screen call information (via net look up or TAPI information) when a new call comes in (and also writes to a callerid.xml database).

What I was going after was the ability to come home from work and look at a nicely formatted call log from within Xlobby. Ideally you could scroll up and down the log and keep/delete entries as you desired. It would also be nice if new calls (calls that occured after the log was last viewed)could be higlighted in some way.

The end result would be a CID display (which you have now) AND a highly useable call log history.

Does this message make sense??? Sorry if I ramble.
smarty
 
Posts: 179
Joined: Thu Jul 27, 2006 12:04 am
Location: San Antonio, TX USA

Postby lar282 on Sat Sep 16, 2006 9:59 am

I have it like this:

The datasbe is sorted so the new calls are on top and when I enter the log screen it refreshes automaically. That way I can see who called today and last.
Sort Order= -1:display

So u want a plugin command like this:
* Delete callerid entry

//Lasse
lar282
 
Posts: 1624
Joined: Thu Apr 01, 2004 4:13 pm
Location: Helsingborg, Sweden

Postby smarty on Sun Sep 17, 2006 6:31 pm

Yeah, that is it!!!

The idea being a person can look through the CID database log, and then delete the old call records so that the next time you look, you know only NEW calls are there.

EDIT: for clarification and update.

This would be complicated by a couple of things. Any pictures that have been set-up to be assocaited with telephone numbers should not be deleted, nor should your net phone look-ups that you save as text files.


Thanks.
smarty
 
Posts: 179
Joined: Thu Jul 27, 2006 12:04 am
Location: San Antonio, TX USA