Sign in to follow this  
Followers 0
Damastah

Forgot how to add strings together

10 posts in this topic

func find()
    $search = FileFindFirstFile("*.jpg*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    
;MsgBox(0, "", $filelist)
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
    $filelist += ", " & $file                                             <--Trying to add the strings here. Does not work
WEnd

; Close the search handle
FileClose($search)

I'm basically trying to get a string with a list of .jpg files in the directory delimited by commas.

Share this post


Link to post
Share on other sites



$filelist &= ", " & $file


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Maybe...

Local $filelist

MsgBox(4096, "File:", $file)
$filelist &= $file & @CRLF

8)

EDIT: for a comma delimited list, enaiman has it!

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Or the long way, if you forget the shorthand version...

$filelist = $fileslist & ", " & $file

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Thank you all. Problem solved.

Share this post


Link to post
Share on other sites

Real men don't use the '&' operator :):lmao:

MsgBox(0,"",ManlyHardcoreStringConjugating("Good"," Night"))

Func ManlyHardcoreStringConjugating($s1,$s2)
    $struct=DllStructCreate("wchar["&StringLen($s1)+StringLen($s2)&"]")
    DllStructSetData($struct,1,$s1)
    DllStructSetData(DllStructCreate("wchar["&StringLen($s2)&"]",DllStructGetPtr($struct)+StringLen($s1)*2),1,$s2)
    Return DllStructGetData($struct,1)  
EndFunc

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Real men don't use the '&' operator :):lmao:

Real men don't have computers.... :think:

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

@monoceres

:) now you have to make all your future scripts like that :shhh: (or are you not a real man? :lmao: )

Of course, my way is the only way.

Real men don't have computers.... :think:

8)

Tell me about it, I've never even used a computer. I write all my scripts on a theoretical basis and have a friend post them to this forum.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Real men don't use the '&' operator :):lmao:

MsgBox(0,"",ManlyHardcoreStringConjugating("Good"," Night"))

Func ManlyHardcoreStringConjugating($s1,$s2)
    $struct=DllStructCreate("wchar["&StringLen($s1)+StringLen($s2)&"]")
    DllStructSetData($struct,1,$s1)
    DllStructSetData(DllStructCreate("wchar["&StringLen($s2)&"]",DllStructGetPtr($struct)+StringLen($s1)*2),1,$s2)
    Return DllStructGetData($struct,1)  
EndFunc
Monoceres divides by zero! :think:

$struct=DllStructCreate("wchar["&StringLen($s1)+StringLen($s2)&"]")

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