Sign in to follow this  
Followers 0
dufran3

Wildcards

7 posts in this topic

#1 ·  Posted (edited)

Is it posible to use wildcards in scripts? example

$FileRead1 = FileReadLine($FileRead,3)
    If $FileRead1 <> '*wildcard*' Then ;<----- so if $fileread1 didn't contain wildcard, it wouldn't msgBox
    MsgBox(0, "Line Read:", $FileRead1)
    EndIf
oÝ÷ Ù.z0­"g ÙèÂ+b²Z()à~ÚìZrÛ-®)à«-+)¢Ë"nW¨­©¢ë-mè§Û¦m*+¯"+y§Z×^r'^vÚÆZvÙ¨­å¡jÒÚ"¬±æ«r§§b­ú+~]z»z·jkj·!x"§b­Ëh¯'è­©ò~]z»z§)àÂ+aªê-JÖ«ªê-jëh×6
;Search
$search = FileFindFirstFile('C:\Program Files\??????\Star*.*')

I am then writing the results to a text file, each folder that it finds is on a new line, I would then like to read the file, and any line that has "star" in it, I would like to assign to a variable so I can perform an action on it.

Edited by dufran3

Share this post


Link to post
Share on other sites



from the help file: (bold mine)

FileFindFirstFile

--------------------------------------------------------------------------------

Returns a search "handle" according to file search string.

FileFindFirstFile ( "filename" )

Parameters

filename File search string. (* and ? wildcards accepted)


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

from the help file: (bold mine)

FileFindFirstFile

--------------------------------------------------------------------------------

Returns a search "handle" according to file search string.

FileFindFirstFile ( "filename" )

Parameters

filename File search string. (* and ? wildcards accepted)

I know that wildcards are accepted in FileFindFirstFile, I have read through that. But what about FileRead? I didn't see anything about wildcards?

Share this post


Link to post
Share on other sites

Do you 'need' the text file or would writing the info to an array be better ?


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I would like to to both. I would like the .txt file for logging, but an array would be sweet. I am afraid of arrays! :-(

Edited by dufran3

Share this post


Link to post
Share on other sites

I am afraid of arrays! :-(

I think that anyone is afraid of arrays the first time, but once you are good at using arrays a whole new world opens up to you.

Anyway, to your initial question.

$FileRead1 = FileReadLine($FileRead,3)
    If StringInStr($FileRead1, "wildcard") Then ;<----- so if $fileread1 didn't contain wildcard, it wouldn't msgBox
    MsgBox(0, "Line Read:", $FileRead1)
    EndIf

For example. All the String.. functions are very useful with what you are trying to do. I wouldn't bother with StringRegExp due to a personal bad encounter with the function. I found it incredibly difficult, and I still don't understand it really.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks a lot, StringInStr is exactly what I needed! Thanks!

Edited by dufran3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0