Script Request - Data Mining Tool.

Discuss and share scripts and script files...
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Script Request - Data Mining Tool.

Post by SkyFrontier »

*Current version is 9* - OUTSTANDING!!!
Download it here.
Direct Link here.
EDIT: Take a little look at this little tutorial, usage guide and hints I wrote. The thing is a little devil, now... :twisted:

(this one will be great... THE TOOL, I mean! lol)
Ok.
Let's do XY scripting rival to Evernote.
Can someone help me building this tool, please?

-It displays 4 input fields.

-It probably will have to store some data to be remembered across sessions by fields 1 and 2 for future usage, and I'd suggest "<xypath>\Data\Custom\DataMiningToolREF.ini" for that.

-field 1 is the EXTENSION the file will have; the script could remember (via .ini) last used extension and display it as suggestion.

-field 2 is the destination path for the file; the script could remember (via .ini) last used path and display it as suggestion.

-field 3 is a blank space that will receive the name of the file that will be created.

-field 4 is a blank space with a wider area that will receive text that will be paste into such file.

-Optionally, each file could start with a blank line/CRLF, having a separator before and after the gathered input, something like:

Code: Select all

<CRLF>
==============
Sample text entered in field 4.
<CRLF>
==============
<CRLF>
But default is the current behavior:

Code: Select all

Sample text entered in field 4.
-an extra option could ask user for preference regarding "ANSI" or "UNICODE", also remembering last used option.

-and a last option asks whether the user wants to append data if the name of the file is the same (ie, fields 1 and 2 being the same and field 3 have the same name of previously stored file or simply is empty) of an existing one.
Appending data MUST contain a separator, being it (==============) or

Code: Select all

<CRLF>
==============
Sample text entered in field 4.
<CRLF>
==============
Appended text if user defines this as an output if user has chosen it so.
<CRLF>
==============
<CRLF>
-a tick box could indicate the script to remain open and ready to append more data to previously written files according to above rules or just write files and shut each time all parameters are set and data entered.
EDIT: A two-button solution will also be welcome. "Append?", "Create File!" The easier for the scripter...

Please...? :D
Last edited by SkyFrontier on 29 Aug 2010 15:57, edited 5 times in total.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Script Request - Data Mining Tool.

Post by j_c_hallgren »

SkyFrontier wrote:Let's do XY scripting rival to Evernote.
Can someone help me building this tool, please?

Please...? :D
Have you tried building any of this yourself yet? It's much better to learn how to fish than always asking for someone else to fish for ya...don't want to be unfriendly but I think it's about time you started more coding yourself and then getting help as you need it...maybe that's the old pgmr in me coming out...ok?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

Hallgren:
Have you tried building any of this yourself yet? It's much better to learn how to fish than always asking for someone else to fish for ya...don't want to be unfriendly but I think it's about time you started more coding yourself and then getting help as you need it...maybe that's the old pgmr in me coming out...ok?
Nice.
Then next time one complain I'm not being clear I'll tell him to learn portuguese so we can have a decent conversation... what about?
Oh, please... :?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

Another little improvement (adding huge usability!): a button could write the file and reload the script, prompting user to create another one thus making it easier to create series of files with different names.

Code: Select all

ALT+TAB to source (Web Browser, for instance), copy text > ALT+TAB to XY, script interface ready, paste text and enter name; press "Create and Reload"; ALT+TAB to source and then again.
Also, field 3 ('name of the file') could have a tick box to convert any entered text into CamelCase:

Code: Select all

name of the file -> NameOfTheFile

name of The File -> NameOfTheFile

Name of the File -> NameOfTheFile
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script Request - Data Mining Tool.

Post by serendipity »

Hi all,

I hope this will help SkyFrontier with consolidating scripts the way he wants. Good luck with porting scripts to XYwiki.

What it does? See SkyFrontier's posts above.

Download:
ScriptTool.xys

Code: Select all

//ScriptTool
   sub _assert;
   global $g_ini;
   self $g_ini, base;
   $g_ini="<xyscripts>\$g_ini.ini";
  
   getkey $lastextension, "lastext", "mru", $g_ini;
   getkey $lastpath, "lastpath", "mru", $g_ini;
   getkey $lastname, "lastname", "mru", $g_ini;
   getkey $lastcamelcase, "lastCC", "mru", $g_ini;
   getkey $lastfile, "lastfile", "mru", $g_ini;
   $lasttext="";
   
   getkey $lastansi, "lastansi", "mru", $g_ini;
   getkey $lastuni, "lastuni", "mru", $g_ini;
   
   
   $ScriptTool=<<<ScriptTool
 
<TABLE border=0>
   <TR valign=middle>
      <TD align=right valign=top>
          <FORM NAME="ScriptTool" ACTION="xys: ">Extension:
      </TD><p>
      <TD><INPUT TYPE=TEXT VALUE="$lastextension" NAME="extension" size="5"><BODY onLoad="document.forms.ScriptTool.name.focus()">
      </TD>
   </TR>
   <TR>
      <TD align=right valign=top>Destination path: 
      </TD>
      <TD><INPUT TYPE=TEXT VALUE="$lastpath" NAME="path" size="50">
      </TD>
   </TR>
   <TR>
      <TD align=right valign=top>Name:
      </TD>
      <TD><INPUT TYPE=TEXT VALUE="$lastname" NAME="name" size="20"><br>
          <INPUT TYPE="checkbox" name="camelcase" value="1" $lastcamelcase> convert to CamelCase
      </TD>
   </TR>
   <TR>
      <TD align=right valign=top>Script: 
      </TD>
      <TD><INPUT TYPE=radio name="encode" value="ASCII" $lastansi> <small>ASCII</small>
         <INPUT TYPE=radio name="encode" value="UNICODE" $lastuni> <small>UNICODE</small>
      </TD>
   </TR>
   <TR>      
      <TD>
      </TD>
      <TD><INPUT TYPE=SUBMIT STYLE=background:DFDFFF name="submit" value="Write">
          <INPUT TYPE=SUBMIT STYLE=background:DFDFFF name="submit" value="Append">
          <INPUT TYPE=SUBMIT STYLE=background:DFDFFF name="submit" value="View/Edit">
          </FORM>
      <TD>
   </TR>
</TABLE>
ScriptTool;


   $g_Tool = urldecode (html("$ScriptTool", 600, 350, "Script Tool"));
   IF ($g_Tool==""){
   status "Script closed.";
   end 1==1;    
   }


  $pathpos = strpos ($g_Tool, "&path=");
  $namepos =strpos ($g_Tool, "&name=");
  $encodepos =strpos ($g_Tool, "&encode=");
  $submitpos =strpos ($g_Tool, "&submit=");

  $extension= replace (gettoken($g_Tool, 1, "&path="), "?extension=","");
  $path= gettoken($g_Tool, 1, "&name=");
  $path = substr ($path, $pathpos+6);
  $path= eval($path);

  IF ($g_Tool Like "*camelcase*"){
  
  setkey "checked", "lastCC", "mru", $g_ini;

  $name= gettoken($g_Tool, 1, "&camelcase=");
  $name = substr ($name, $namepos+6);

  $name= replacelist($name, " a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z", "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z",","); 
  $first=substr($name,0,1);
  $first=replacelist($first, "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z","A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,,Q,R,S,T,U,V,W,X,Y,Z",",");
  $name=substr($name,1);
  $name=$first.$name;
  
  $camelcase=gettoken($g_Tool,4,"&");
  $camelcase=gettoken($camelcase,2,"=");

  }
  ELSE{
  $name= gettoken($g_Tool, 1, "&encode=");
  $name = substr ($name, $namepos+6);

   $camelcase="";

   }

   

  
  $encode= gettoken($g_Tool, 1, "&submit=");
  $encode = substr ($encode, $encodepos+8); 

  $submit= substr ($g_Tool, $submitpos+8);

   
   IF ($encode=="UNICODE"){
   $mode="tu";
   setkey "checked", "lastuni", "mru", $g_ini;
   setkey "", "lastansi", "mru", $g_ini;   
   }
   ELSE{
   $mode="ta";
   setkey "", "lastuni", "mru", $g_ini;
   setkey "checked", "lastansi", "mru", $g_ini;   
   }
   
   
   IF ($extension == ""){
   msg "No extension provided!";
   load self("file");
   }
   
   setkey $extension, "lastext", "mru", $g_ini;

   IF ($path == ""){
   msg "No path provided!";
   load self("file");
   }

   setkey $path, "lastpath", "mru", $g_ini;

   IF ($name == ""){
   msg "No name provided!";
   load self("file");
   }
   
   setkey $name, "lastname", "mru", $g_ini;

      
    $lastfile= "$path$name.$extension";
    setkey $lastfile, "lastfile", "mru", $g_ini;
  
   $textfooter="<crlf><crlf>===============<crlf><crlf>";
   $on_exist="o";

   
   IF ($submit=="Append"){
   $text="";
   $edittext= input ("Append below text to $path$name.$extension Mode:$encode",,$text, m, "cancel",800,600);
   IF($edittext=="cancel"){
   load self("file");
   }
   $text="$textfooter $edittext";   
   $on_exist="a";   
   }
  
   ELSEIF ($submit=="View/Edit"){
   $lastext="";
   IF (exists("$lastfile"=="1")){
   $lasttext= readfile ("$lastfile");
   }
   $edittext= input ("View/Edit text $path$name.$extension Mode:$encode",,$lasttext, m, "cancel",800,600);
   IF($edittext=="cancel"){
   load self("file");
   }
   $text= $edittext;
   }

   ELSE {
   $text="";
   $edittext= input ("Write below text to $path$name.$extension Mode:$encode",,$text, m, "cancel",800,600);
   IF($edittext=="cancel"){
   load self("file");
   }
   $text= $edittext;
   }

   writefile ("$path$name.$extension", $text, $on_exist, $mode);
   load self("file");
  
   end(1==1);


"_assert : _assert"
  $minimum = "9.40.0000"; 
  $compatible = (compare(<xyver>, $minimum, v) == -1) ? 0 : 1; 
  assert ($compatible), "This script needs XYplorer version $minimum or higher.", 1; 
To see the attached files, you need to log into the forum.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

Almost there... :wink:
Users: Test it with caution. There's a few flaws which I already reported to Serendipity. So please consider this as a beta test only.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script Request - Data Mining Tool.

Post by serendipity »

I think i fixed them all. Another try.

Download:
ScriptTool.xys
To see the attached files, you need to log into the forum.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script Request - Data Mining Tool.

Post by serendipity »

A third one now.
ScriptTool.xys
To see the attached files, you need to log into the forum.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

*IMPORTANT NOTE*
-the script must be placed *as it is* under "<xydata>\Scripts\ScriptTool.xys"
This is a slightly modified *tested* version 3.1.
Has several functions working flawlessly according to requested specifications but there's more to come - actual usage of this 3.1 version led to some ideas concerning usability that you'll probably like.
Think about this as a Ditto/Evernote hybrid.
EDIT: of course we're talking about *text-only pieces of data*... This won't certainly grab your handwritten notes and paste it into a search-able database, doing OCR on the writings and multi-tagging stuff around... Just a little advice for the young at heart... :wink:
*Use* it before judging out of description and you'll see the difference on data mining tasks...

Changes:
-now turns recursion check off.
-keeps all previously used data at hand for future usage even after reloading.
-reloading function fully functional.
-view/edit opens a file in real time, if entered "name" matches an existing file (untick "Convert to CamelCase" if you see some anomalies in presence of existing files named as "Test Text" and "TestText", for example).
Enjoy! 8)

(script made by serendipity.)
To see the attached files, you need to log into the forum.
Last edited by SkyFrontier on 27 Aug 2010 17:21, edited 1 time in total.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script Request - Data Mining Tool.

Post by serendipity »

OK, its ScriptToolv5 now.

-Made it a bit more user-friendly.
-Now you can write a file and shut it. Previously it always reloaded the script back by default.
-Now it can be run from anywhere, as in you can paste this to catalog and start working. Previously, it had to be in a file.
-Currently the ini is written to XYplorer's scripts folder. Change it if you want.
ScriptToolv5.xys
To see the attached files, you need to log into the forum.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

Generic questions:
-can the script window (XY feature) remember last position on screen after reloading? Is there a parameter for this to happen anywhere, hardcoded inside script, at least and as a last resource?
-is the script window (XY feature) able to select entire content of an input box on clicking on it, instead of having to delete letter after letter manua(tedious)lly?
The script is AWESOME! :P

EDIT: Newcomers, double-click on the NAME field does the trick for the 2nd question.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script Request - Data Mining Tool.

Post by serendipity »

ScriptToolv6
-fixed a bug which would not let view/edit to edit anymore.
-Now If "paste clipboard" is checked and "reload script" is unchecked, script writes/appends and closes immediately.
-Title bar reflects script file's name if it exists else just shows ScriptToolv6.
ScriptToolv6.xys
@SkyFrontier: I am doing this hoping that you will revive the XYwiki. I hope that's still true. :wink:
To see the attached files, you need to log into the forum.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

Serendipity:
@SkyFrontier: I am doing this hoping that you will revive the XYwiki. I hope that's still true. :wink:
You don't have to believe me... :wink:
Check this out...
-thanks, man! :mrgreen:
To see the attached files, you need to log into the forum.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script Request - Data Mining Tool.

Post by serendipity »

SkyFrontier wrote:Serendipity:
@SkyFrontier: I am doing this hoping that you will revive the XYwiki. I hope that's still true. :wink:
You don't have to believe me... :wink:
Check this out...
-thanks, man! :mrgreen:
Nice, thanks in advance for XYwiki update.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Data Mining Tool.

Post by SkyFrontier »

Doing the best I can and counting on community's invaluable help.
It's a hell of a task and I'm new to all of this plus -have a life to care of, too! :D
(Note to self: "you have a life to care of, too!")
(hope Don puts Time 2.0 on the roadmap soon, along with the Time Machine...)
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply