nScriptm
--
    -   


 


		a = 1234; //    
		a = -123; //
		a = 0123; //  
		a = 0x12; //  
            
 

		str = "abc" + "def"; // "abcdef"
		i = 1 + 2;
		str = "1 + 2 = %i%"; // "1 + 2 = 3"
            str = "abc" + 1;          //"abc1"
		str = 1 + 2 + "abc";      //"3abc"
		str = "" + 1 + 2 + "abc"; //"12abc"

 

              

         1)     a = "aaa\r\nbbb\r\nccc";
        	RegMatchAll(".*$", a, b[]);
		// b[0] - aaa
		// b[1] - bbb
		// b[2] - ccc
         2)
             	"^http://([^:/]+)%server%(:(\d+)%port%)?%path%$" = "http://www.url.com/index.html"; 
                //server -  www.url.com
                //path   -  index.html

              parse()

                str="http://www.url.com/index.html";
                parse(str,strnull,"http://",server,"/",path); 
                //server -  www.url.com
                //path   -  index.html
                



 
		
		\n	 
		\r	CR
		\t	TAB
		\b	beep
		\\	\
		\"	"
		%%	%
		\ooo	 
		\xhh	 
		


		a[0] = "abc";
		a[1] = "def";
		b["foo"] = 13;

		a[100];  
		a["100"]; 

		a[1][0]     = f; 
		a["foo"][2] = f; 

		

			a[] = b[];       
			a[] = b[] + c[]; 
		

			a[] = {1,2,3}; // a[0] = 1;a[1] = 2;a[2] = 3; 
			a[] = {a = 10, b = 20}; //a["a"] = 10;a["b"] = 20; 
			a[] = {1,2,{10,20,{"a","b","c"}},3}; 

		

			a[] = 0;                //a[] = 0[] 
			b = {"A", "B", "C"}[1]; 
		

			str = "%hoge[\"ab\" + i]%";


 

		var i, j = 100, f[];
            
            for(i=1;i<10;i++)
            {
             m[i]=i;
             f[i]=1;
            }
            a=f[3] //3 
            b=m[3] //0   m[]     

 

		
		a + b  
		a - b  
		a * b  
		a / b  
		a % b    
            a & b   
		a | b   
		a ^ b  
		a << b  
		a >> b  
		

 

		+a   
		-a   
		a++  
		a--  
		++a  
		--a  
		!a   
		~a   
		

 

			a = 1;
			b = a++;
			a = (b = 4) + 5; // a=9 b=4
			"([ABC]+)%i%" = "123ABCCBA456"; //i="ABCCBA" 
	
 
		
		
		a == b  
		a =~ b  
		a != b 
		a < b   
		a > b  
		a <= b  
		a >= b  
		
		a && b  
		a || b  
		

	






	if ()
      {
      
      }
      else
      {

      }

          

			if(a == 0){
				b = 0;
			}else if(b == 0){
				a = 0;
			}else if(a > b){
				b = a;
			}else{
				a = b;
			}


 

	while () {}
      
        
			i = 1;
			while(i <= 10){
				j = j + i;
				i = i + 1;
			}

	do { } while();

	for(   ;    ;   ) {}

			for(i = 1; i <= 10; i++){
				j = j + i;
			}

			for(;;){
				//  
			}

       break [n];

	         

			while(){
				while(){
					break 1; //1    
				}
			}

	continue     


 
              
		

	switch
	
			switch(m)
			{
			case 1:
				;
				break;

			case 2:
			case 3:
				;
				break;
			default:
				;
				break;
			}


 

		Function (, [ 2, ...])
		{
			 ;
		}

		ArgMatch ("")
		{
			 ;
		}

		Function sum(arg_1, arg_2){
			return arg_1 + arg_2;
		}

		Function func(&a) //    
		{
			a = 100;
		}

		func(i); //i=100

	

		Function func(a, b) 
		{
			i = a;
			j = b;
		}

		Function func() //    
		{
			i = arg[0];
			j = arg[1];
		}

		Function func(a, b = 100) //     
		{
		}


		Function func("%a%,%b%")
		{
			i = a; // "123"
			j = b; // "456"
		}

		func("123,456");

		ArgMatch func("%a%,%b%")
		{
			i = a;
			j = b;
		}

		?("123,456");

		ArgMatch func1("%a%,%b%")
		{
			i = a;
			j = b;
			exit; 
		}
		ArgMatch func2("%a%,%b%") 
		{
			i = a;
			j = b;
		}

		cnt = ?("123,456"); 


        


		script.func();
		script.?();
		&script.func();
		script.i = 0; 



  (   )

	 

		\	
		^	
		.	
		$	
		|	
		()	
		[]	
		%`%	

		*	
		+	
		?	
		{n}	
		{n,}	
		{n,m}	

		*?	
		+?	
		??	
		{n,}?	
		{n,m}? 

		\t	
		\n	
		\r	
		\xhh	
		\w	
		\W	
		\s	
		\S	
		\d	
		\D	

	"([ABC]+)%i%" = "123ABCCBA456"; //i="ABCCBA"
	a = "aaa\r\nbbb\r\nccc";
	RegMatchAll(".*$", a, b[]);
		// b[0] - aaa
		// b[1] - bbb
		// b[2] - ccc


 

	#option(explicit)

	#import()
       // 
			script.func(); //֐
			script.i;      //ϐ

	#library()









	Error(buf)
		
               
            
             :  - 0

	Sleep(time  ), _sleep(time   )
             
		 : 	0

	GetDate(format)
		
			format -   "yyyy/MM/dd"

             :    
		

	GetTime(format)
		
			format -   "HH:mm:ss"

             :    

        SetTime(hh,mm,ss)
        SetDate(year[,month[,day]])

               
             0   .


         playsound(filename,strparameters)

             wav    filename
            strparameters="str1 str2 ... strn"
            strX=SYNC ASYNC NODEFAULT LOOP NOSTOP
              
    



      msgbox(message,title,type)

               

            type = 0 - 7 ( MessageBox  Win32 API)
            
             :    

      fileopendialog(title)
      fileopendialog(title)
      folderdialog(title)
      
             open/save/select folder 

              :         


      poweroff() 
           

      getsdialog(title,string) 
           / 
           


      getcbdialog(title, items[],titleokbutton="Ok",titlecanselbutton="Cancel",titlebutton3="",titlebutton4="") 
                  listbox  4 
                  items  - hash()   
                  titleokbutton,titlecanselbutton,titlebutton3,titlebutton4 -   

                   :   (  3  4    1000  10000 ),
                    cancel -    -1 


      getscriptfullname()
                      
      getnsfullname()
                     ns.exe   

       


  


	IsType(val)
           :  -   
			0 -  
			1 - 

	Int(str)
	UIntStr(i)
	Chr(i)
	Asc(buf)
	String(cnt, char)
                   :       
			cnt -  
			char - 
	Trim(buf)
	Len(buf)
	StrCmp(str1, str2, len = -1)
                : 
			0 - str1 == str2
			>0 - str1>str2
			<0 - str1<str2

	Left(buf, len)
	Right(buf, len)
	Mid(buf, index, len = -1)
	InStr(buf, str, start = 0, op = 0)
	ToLower(buf)
	ToUpper(buf)
      translate(str,s1, s2) 
               :       s1     s2
      pos(substring, string) 
              :     
      
      strtok(delimiters, string) 
                 strtok  C,    ;
      parse(string, substring1,delimiter1,...,substringN,delimiterN) 
                   ,        


      _e(string)
             .
             .
              (    nScript  ). 
             :
         sin,cos,tan,asin,acos,atan,sinh,cosh,tanh,exp,log,log10,sqrt,floor,ceil,fabs,deg,rad 
           ,   _e("a=cos(0.5)");
           - pi, e
         
          str=_e("cos(0.23)/(4-2.5)"); //str="0.64911093000358322"
 
      
     




Hash


	GetHashCount(hash[])
	SetHashCount(&hash[], len)
	GetHashKey(hash[], n)
	SetHashKey(&hash[], n, name)
	IsHashKey(hash[], key)
	HashInsert(&hash[], n, val)
	HashDelete(&hash[], n)
	HashFind(hash[], val)
	HashKeySort(&hash[], order = 0, icase = 0)
	HashSort(&hash[], order = 0[1], icase = 0[1])
      HashCopy(hash[], start = 0, len = -1)
	HashMerge(hash1[], hash2[], hash3[]...)
	HashToString(hash[])
	StringToHash(buf)
	

 

	RegMatch("reg", buf, &hash[] = 0, op = "")
	RegMatchAll("reg", buf, &hash[] = 0, op = "")
	RegReplace("reg", to, buf, op = "")

 

	IsLeadChar(buf)
	GetCodeType(buf)
             : 
			0 - ASCII
			1 - SJIS
			2 - JIS
			3 - EUC

	SjisToJis(buf)
	JisToSjis(buf)
	SjisToEuc(buf)
	EucToSjis(buf)
	Base64Decode(buf)
	Base64DecodeHash(buf, &hash[])
	Base64Encode(buf)
	Base64EncodeHash(hash[])
      cpconvert(string,fromto)
                            
               fromto -    "win2alt","win2koi","win2iso","koi2alt","koi2win","koi2iso","alt2koi","alt2win","alt2iso","iso2win","iso2koi","iso2alt"
                :   
      cpaconvert(string, to)
                    
               to - "win","koi","iso","alt","lat"
                :   


 

	CreateDirectory(dir)
	RemoveDirectory(dir)
	GetCurrentDirectory()
	SetCurrentDirectory(dir)
	CopyFile(from, to)
               :  
			0 - ok
                  -1 - error

	MoveFile(from, to)
               :  
			0 - ok
                  -1 - error

	DeleteFile(file)
               :  
			0 - ok
                  -1 - error

	FileOpen(type, file)
		 
			type - "read", "write", "new" 
			file -  
		 : 
			    -1   

	FileClose(f)
      Filesetptr(f, pos, type ) 
                      
                	type - 0,1,2 
                  pos - 
			f -  
                   0    ;

	GetFileSize(f)
                         :  
			    -1   

	FileRead(f, &buf, len)
                 
			f -  
			buf - 
			len -    (  -  )
               :  
                   
      Readstr(,&buf,len=1024)
                   
               :  
                     -1   


	FileReadHash(f, &hash[], len)
	FileWrite(f, buf, len = 0)
			f -  
			buf - 
			len -  
               :  
			0 - ok
                  -1 - error


	FileWriteHash(f, hash[], len = 0)
	FileFindInit(file)
                     
			file -   (   *  ?)
                   :  
                       0       

	FileFindNext(hFind)
               
			hFind -    FileFindInit()
		   : 
			1 -  
                  0 -   

	FileFindClose(hFind)
                  hFind -    FileFindInit()

	FileFindAttributes(hFind)
                      
                      Win32 API
  
	FileFindName(hFind)
                      

	FileFindSize(hFind)
                      


    


        

        dblist(a[])
              a        "name,type,size,nrecord,date,time"   
              

        dbdelete(name)
              



                  
 



	Shell(file, param = "", dir = "", style = 1)
               
			file -  
			param - 
			dir - 
			style - 0,1,2,3 (  Win32 API)
		 :  
			0    
                  -1   
        Shellwait(file, param = "", dir = "", style = 1)
                   
			file -  
			param - 
			dir - 
			style - 0,1,2,3 (  Win32 API)
		 :  
			0    
                  -1   

	ExecScript(path, file, param[])
                   

        runappattime(file,year,month,day[,hour,minutes,second])
                          
                   :  
			1    
                        0   

      setwindowtext(hwnd,title)  
             
           

      listwindow(list[])
             (list[])      

      iswindowvisible(hwnd)     
             > 0     hwnd    
         

      FindWindow(string, full=0) 
           full -  1,       string   ,
                  string
             ,     ,  0   
      SendKeys(hWnd,string,keys)
               
           hWnd -   ,
           string -   ,   \r - ENTER  \t - TAB[,
           keys -     shift - 16 ctrl - 17 alt - 18]) 

      destroywindow(hWnd)
           
      setfwindow([hWnd]) 
            ,        nScript;
     getfwindow() 
             
     tap(x,y[,hWnd]) 
             (x,y)
           ,     


   

	gethostname()
	gethostbyname(server)
	getsockport(soc)
	socket(af = 2, type = 1, protocol = 0)
			af - Address family
				0 - AF_UNSPEC
				1 - AF_UNIX
				2 - AF_INET
			type 
				1 - SOCK_STREAM (TCP)
				2 - SOCK_DGRAM (UDP)
			protocol - 
	closesocket(soc)
	connect(soc, ip, port)
	bind(soc, ip, port)
	listen(soc, backlog)
	accept(soc)
	select(soc, time)
	recv(soc, &buf, len = 256, flags = 0)
			flags -
				MSG_OOB - 0x1
				MSG_PEEK - 0x2
	RecvHash(soc, &hash[], len = 256, flags = 0)
	send(soc, buf, len = 0, flags = 0)
			flags - 
				MSG_OOB - 0x1
				MSG_DONTROUTE - 0x4
	SendHash(soc, hash[], len = 0, flags = 0)


              -1   


  


rgset(key,subkey[, valuename,valuedata,valuetype])
       /  
          key - "HKEY_CLASSES_ROOT","HKEY_CURRENT_USER","HKEY_LOCAL_MACHINE"
          subkey  -    ,
          valuename  -  
          valuedata -  
          valuetype - "REG_SZ,"REG_DWORD","REG_BINARY" 
           :   0    

rggetvalue(key , subkey, valuename, buf ) 
        key - "HKEY_CLASSES_ROOT","HKEY_CURRENT_USER","HKEY_LOCAL_MACHINE"
          valuename  , 
           buf,
                 

rgexport(key , subkey,filename) 
            , 
         1    

rgimport(filename) 
            , 
         1    

rgdeletevalue(key, subkey , valuename ) 
         ,
         key - "HKEY_CLASSES_ROOT","HKEY_CURRENT_USER","HKEY_LOCAL_MACHINE"
         subkey  -    ,
         valuename  -  
          0    

rgdeletekey(key, subkey) 
         ,
        key - "HKEY_CLASSES_ROOT","HKEY_CURRENT_USER","HKEY_LOCAL_MACHINE"
        subkey  -    ,
         0    ;


 

      clipset(string) 
             ;
      clipget() 
             ;
         




/

	puts(buf)
		    

	gets(len)
		   

	getchar()
		 

	SetEchoMode(n)
			n - 0 = echo off, 1 = echo on




--

