Question about adding to a String

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
DeltaZ
Newbie
Posts: 5
Joined: Tue Apr 30, 2019 10:21 am

Question about adding to a String

Post by DeltaZ » Thu May 09, 2019 6:20 pm

Hi again.

Now on to the other part of my macro that i ran in to something.

I want to combine full filepaths of all files in a folder into a separate string to then combine it with a command for a program before that.

Example

In d:\temp i have 3 files. test001.wav, test002.wav and test003.wav
I already have it to extract just the filename and combine it with a remote web folder.
http://www.visuell3d.se/test/sounds/test001.wav
I have a Repeat that cycles through the array of files from the GetFileList of d:\temp

I want a String that is "http://www.visuell3d.se/test/sounds/test001.wav http://www.visuell3d.se/test/sounds/test002.wav http://www.visuell3d.se/test/sounds/test003.wav"

If it looks unclear, it´s a space between the filepaths.

So that i can then combine it with another thing before that string like this: "vlc --loop http://www.visuell3d.se/test/sounds/test001.wav http://www.visuell3d.se/test/sounds/test002.wav http://www.visuell3d.se/test/sounds/test003.wav"

Hopefully it makes sense.

/Daniel

Code: Select all

Let>SourceFolder=d:\temp
Let>RemoteFolder=http://www.visuell3d.se/test/sounds/
GetFileList>%SourceFolder%\*.wav,files
Separate>files,;,file_names
ExtractFileName>file_names_%k%,oldfilename
Let>k=0
Repeat>k
  Let>k=k+1
  ExtractFileName>file_names_%k%,oldfilename
  Let>combined=%RemoteFolder%%oldfilename%
  MessageModal>combined

// Create a string of full paths of all files

Until>k,file_names_count


// Combine string with ssh vlc command --loop string

// Open up SSH Program and send command with string to start process

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 440
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Question about adding to a String

Post by Dorian (MJT support) » Thu May 09, 2019 10:03 pm

If it's doing what you want but you're struggling to make the string add to itself, try something like this :
I just changed the "combined" line and added Let>combined= at the beginning.

Code: Select all

Let>combined=
Let>SourceFolder=d:\temp
Let>RemoteFolder=http://www.visuell3d.se/test/sounds/
GetFileList>%SourceFolder%\*.wav,files
Separate>files,;,file_names
ExtractFileName>file_names_%k%,oldfilename
Let>k=0
Repeat>k
  Let>k=k+1
  ExtractFileName>file_names_%k%,oldfilename
  Let>combined=%combined% %RemoteFolder%%oldfilename%
  MessageModal>combined
// Create a string of full paths of all files
Until>k,file_names_count

// Combine string with ssh vlc command --loop string

// Open up SSH Program and send command with string to start process
Top

A very simple cut down example :

Code: Select all

Let>MyString=Hello
Let>MyBigString=

Let>k=0
Repeat>k
  Let>k=k+1
  Let>MyBigString=%MyBigString% %MyString%%k%
Until>k,10


MessageModal>MyBigString
Always accepting custom script commissions. Message me or go here

DeltaZ
Newbie
Posts: 5
Joined: Tue Apr 30, 2019 10:21 am

Re: Question about adding to a String

Post by DeltaZ » Fri May 10, 2019 12:48 pm

Thanks so much!

That worked out great!

/Daniel

Post Reply