Source language: Translate to:

I don't want "Hidden Files" ... ?

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

I don't want "Hidden Files" ... ?

Postby TMcD » Mon Jun 09, 2014 2:08 am

When using FileList, how to I exclude "Hidden Files" ?

I don't see an option or some sort of RegEx I can do in there.

FileList "[folder]\*.png" "Files" "[slidefiles]"

This picks up 2 files, when I only want the "visible", "non hidden" file(s):

._Slides.001.png
Slides.001.png

I am expecting to only get:

Slides.001.png

Thanks
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: I don't want "Hidden Files" ... ?

Postby dec » Mon Jun 09, 2014 2:49 am

Hello,

If you like considerer to use the npFind plugin, which allow you to search for files and folders using lot of options, including search for file mask plus file attributes. I modified a bit one of the plugin included samples to shown you how to skip hidden files from the search results.

Image

Download the sample and compiled application from this link:

http://neoplugins.com/Humm/Sites/Main/V ... nFiles.zip
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: I don't want "Hidden Files" ... ?

Postby dpayer » Mon Jun 09, 2014 8:48 am

David Esperalta has a more elegant solution than I do but if you want to use only NB actions you can use FileList to get a list of all the files in the folder with the criteria you have (example *.png) and then create a subroutine to check for their attributes using either a batch file or a VB function.

example (not tested):

Code: Select all
FileList "[path]" "Files" "[myfilelist]"
If "[myfilelist]" "<>" ""
    StrParse "[myfilelist]" "[#13]" "[myfiles]" "[numfiles]"

    Loop "1" "[numfiles]" "[WILL]"
.determine the file attribute using the attrib command line utility - port to the clipboard
.use compound variable to determine the file being looked at
        Run "cmd.exe" "/c [#34] attrib [myfiles[WILL]] | clip[#34]"
        SearchStr "[clipboard]" "H        " "[foundHAttr]"
            If "[foundHAttr]" "<>" "0"
. we didn't find the hidden attribute
                Endloop
            Else
.set this line in the myfiles variable to empty
            SetVar "[myfiles[WILL]]" ""
            StrReplace "[myfiles]" "[myfiles[WILL]][#13]" "" "[myfilelist]" ""
            Endif
    Endloop
Endif
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1383
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: I don't want "Hidden Files" ... ?

Postby virger » Mon Jun 09, 2014 9:42 am

In that case I use this:
I hope you serve.

Run "Dir" "[PubDir]*.* /a-h > [PubDir]Lista" "RunOnce+Wait+LoadComplete+Minimized+Hidden" "" ""
FileRead "[PubDir]Lista" "All" "[lista]"

PURA VIDA
COSTA RICA
BRAZIL-2014
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 523
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: I don't want "Hidden Files" ... ?

Postby TMcD » Mon Jun 09, 2014 1:48 pm

Thanks guys, I went ahead and made my own workaround....

This should be part of native NeoBook, since 99.9999999999999999999999999999999999999999999% of the time I'm sure people want the "actual" files and not the (hidden) ones windows makes for a reference, or whatever those files are.
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: I don't want "Hidden Files" ... ?

Postby dec » Mon Jun 09, 2014 2:10 pm

Hello,

TMcD wrote:Thanks guys, I went ahead and made my own workaround....

Share with us so anyone can know another possible way.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: I don't want "Hidden Files" ... ?

Postby TMcD » Mon Jun 09, 2014 2:36 pm

It's not just the routine itself, (as it has other things specific to the app)... but you'll get the idea:

Code: Select all
... Get the list of slide names
FileList "[folder]\*.png" "Files" "[slidefiles]"
... Extract the slide file names
StrParse "[slidefiles]" "[#13]" "[tempslide]" "[tempnumberofslides]"
... Remove any system files like ._Slide1.png
Loop "1" "[tempnumberofslides]" "[loop]"
SearchStr "._" "[tempslide[loop]]" "[hiddenfile]" ""
... This means we found a regular image file
If "[hiddenfile]" "=" "0"
... Update counter, because [tempnumberofslides] can be inaccurate to what I need.
SetVar "[count]" "[count]+1"
... Add the "non-hidden" image to the list of images
SetVar "[slide[count]]" "[tempslide[loop]]"
EndIf
EndLoop
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: I don't want "Hidden Files" ... ?

Postby Neosoft Support » Tue Jun 10, 2014 10:51 am

Why do you have hidden png files?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: I don't want "Hidden Files" ... ?

Postby TMcD » Thu Jun 12, 2014 11:46 pm

Neosoft Support wrote:Why do you have hidden png files?


Good question...
I call them hidden files, as they seem to be some sort of reference file or something Windows creates.

I have my folders set to show "hidden files", so there is for example a "hidden" file for each image, as in:

slide.png (real file)

windows created "hidden file is shown in the folder:

._slide.png

Troy

* The setting in windows is: Folder Options > Hidden files and folders > (X) Show hidden files, folders and drives

P.S. I am guessing that the average user wouldn't need this routine, because "hidden" files are not seen, thus not seen by NeoBook and not needing to be handled by NeoBook. Am I right?
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: I don't want "Hidden Files" ... ?

Postby Neosoft Support » Fri Jun 13, 2014 10:06 am

windows created "hidden file is shown in the folder:

._slide.png


I haven't heard of Windows creating hidden files like that before. Maybe they were created as a backup by the program you used to generate the png images? I think this is unusual behavior.

* The setting in windows is: Folder Options > Hidden files and folders > (X) Show hidden files, folders and drives

P.S. I am guessing that the average user wouldn't need this routine, because "hidden" files are not seen, thus not seen by NeoBook and not needing to be handled by NeoBook. Am I right?


NeoBook doesn't recognize the show hidden files setting in Windows.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: I don't want "Hidden Files" ... ?

Postby TMcD » Fri Jun 13, 2014 12:23 pm

I just found out that they are MAC OSX reference files.

I'm running NeoBook on a MAC with WIndows 7 installed on Parallels.

Ya learn something every day.

Thanks,
Troy
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest