Source language: Translate to:

.bat to neobook

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

.bat to neobook

Postby Alex » Wed Jan 31, 2007 11:25 am

Hi,

I want to delete all my temp file, so I do a batch file :

echo o|del "%USERPROFILE%\Local Settings\Temp\*.*"
echo o|del "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*"
echo o|del "%WINDIR%\Temp\*.*"
echo o|del "%USERPROFILE%\LOCALS~1\TEMPOR~1\Content.IE5\*.*
echo o|del "%USERPROFILE%\LOCALS~1\TEMPOR~1\*.*
echo o|del "%USERPROFILE%\Cookies\*.*

The problem is I want to have this in my Neobook program, how can I convert this to Neobook, I tried with FileErase but it saied it couldn't find the file.


Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Wed Jan 31, 2007 11:36 am

Alex:

Have you tried using the Run command to just run (execute) your .bat file ?

You can do it with the FileErase command ... but it only does one file at a time ... so you would first have to get a list of files in the specified folder with the FileList command ... then, for each file in the list invoke the FileErase command.

Please note that ... whatever method you use ... depending on your NeoBook application ... if the application causes some files to be placed in the Windows Temp folder, erasing them while running your application can/may cause problems.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Wed Jan 31, 2007 11:43 am

Hi Gaev,

With Run it works very well, but I want to have a Neobook Action, it's better.
What happen if I delete all Temp folder ? Windows will creat a new folder ? No ?
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Wed Jan 31, 2007 12:29 pm

Alex:
With Run it works very well, but I want to have a Neobook Action, it's better.
... in what way ? ... it will be much faster than doing a FileErase command inside a Loop/EndLoop block for each file in the folder.
What happen if I delete all Temp folder ? Windows will creat a new folder ? No ?
... I am not sure Windows will allow you to delete the folder ... but I could be mistaken.

My earlier caution was regarding files in the folder ... e.g. if you have embedded components (images, plugins etc.) that NeoBook is directed to extract to the Temp folder ... if you then (try to) do a FileErase on these files, I am not sure what errors will arise.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neobook » Tue Feb 06, 2007 12:00 pm

Hello,

Thanks


I tried with :

Setvar "[f]" "C:\Documents and Settings\Ohgon\Local Settings\Temp\"
Setvar "[g]" "*.tmp"
FileErase "[f][g]"

It saied ERROR


Why ?
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

Postby Gaev » Tue Feb 06, 2007 12:16 pm

NeoBook:
Setvar "[g]" "*.tmp"
FileErase "[f][g]"

It saied ERROR


Why ?
... NeoBook's FileErase command DOES NOT support use of wild cards (like * and ?) ... the file name must be specific ... like abc.txt
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neobook » Tue Feb 06, 2007 12:39 pm

Thanks

But there are the all time new temp file with new name, so I tried this :

FileList "C:\Documents and Settings\Ohgon\Local Settings\Temp\*.*" "Files" "[g]"
StrParse "[g]" "[#13]" "FileName" "[FileCount]"
Random "[FileCount]-1" "[RandomFileNumber]"
SetVar "[RandomFileNumber]" "[RandomFileNumber]+1"
FileErase "[RandomFileNumber]"

But it's saied Unable to .....

Why ???
Neobook
 
Posts: 131
Joined: Sat Jul 01, 2006 7:07 am

Postby Gaev » Tue Feb 06, 2007 1:41 pm

NeoBook:
But it's saied Unable to .....

Why ???
... do you know what you are doing ? ... if you are not careful, you will cause untold damage to your computer by FileErase'ing files you didn't mean to ... until you know that a routine works, you should check the name of the file you want to erase first ... perhaps using AlertBox in place of the FileErase command.
Code: Select all
StrParse "[g]" "[#13]" "FileName" "[FileCount]"
... [FileCount] is a number representing the number of files returned in the list by the FileList command ... e.g. 50
Code: Select all
Random "[FileCount]-1" "[RandomFileNumber]"
SetVar "[RandomFileNumber]" "[RandomFileNumber]+1"
... [RandomFileNumber] is number between 0 and [FileCount]-1 ... e.g. 0 or 26 or 49
Code: Select all
FileErase "[RandomFileNumber]"
... did you mean to delete a file called "0" or "26" or "49" ?

I am not sure why you are using the Random command here ...
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Thu Feb 08, 2007 8:15 am

Hello,

How can I do for delete all file and folder in Temp ???
I didn't understand
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Sam Cox » Thu Feb 08, 2007 8:39 am

Hello Alex,

I agree with Gaev when he advised that "if you are not careful, you will cause untold damage to your computer." I understand that you want to clean out the places in which Windows deposits "junk" files, but remember that Windows is a multi-tasking environment and there may be programs or processes running that you are unaware of. Some of those programs or processes may be relying on temporary files or other structures in various Windows "temp" locations.

That being said, look into using a well-written and FREE tool that specializes in this sort of work. The tool is called "ccleaner" (notice two c's) and is available here: http://www.ccleaner.com/. I use this tool everyday. I would not ever consider doing this job myself with a Neobook script even though I'm pretty sure I could write the code to do so.

Added later: Because ccleaner can be run as a command line utility, it can be invoked from a Neobook program.

-- Sam
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Postby Alex » Thu Feb 08, 2007 11:32 am

Ok,

Thanks,

It's very good


Thanks
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests