How to check for file data, not file?

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
We have a macro called file.exists, and it checks for the existance of a file, which is cool.

However i tried setting up a string-in-file.exists macro workaround. All i could think of was doing a file.get.block macro and using as delimiter the field data of the previous step, which contained the value i was looking for. evidently, the value would spring up as a field value earlier on in the template and it isn't fixed.

but that didnt work. is there anything u guys are doing to cover for this? some fancy javascript thingie? as i still dont understand js, so hmm...
 

Stereomike

Client
Регистрация
29.03.2011
Сообщения
221
Благодарностей
30
Баллы
0
You just want to check, if the string "zaphod" is in the file?
{-File.GetString-|-\WORKFILES\FORMATTED\test.txt-|-all-|-false-|-zaphod.*?-|-0-}
means:watch all strings of test.txt (don't delete), parse for zaphod (shortest match, if you want to find zaphodism as well, drop the '?'), take first result of query

The following step must be a {logic step}, to determine what to do, if the above string was found:
(if) '{-FieldData.FieldData-|-mainloop-|-ZaphodCheck-}'!=''
means: if zaphod is not found=true
if you cannot guarantee, that it will be only zaphod (but as well zaphodism, zaphodia etc) you should go with '!='

(if) '{-FieldData.FieldData-|-mainloop-|-ZaphodCheck-}'=='zaphod'
means: only if zaphod is found=true

hope it helps!
 

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
nice, that zaphod.? means its singleline and it'll get me all strings with zaphod.

but what about if zaphod is really field data from a previous step? say you find zaphod and then you want to erase all the files that have zaphod, but make a template that can be easily self sufficient and you dont have to edit the regex from zaphod to ziffy everytime you want to try a new value. in my experience i havent been able to introduce a {Field Data- yada yada} into a regex. perhaps this is something that quite simply cannot be done?
 

Stereomike

Client
Регистрация
29.03.2011
Сообщения
221
Благодарностей
30
Баллы
0
{-RegExp.RegExp-|-{field-data}-|-zaphod.*?-|-0-}

That would check, if "zaphod" is in that field. If it is, this step puts out "zaphod", if it is not found it outputs an empty string ( "" )
 

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
shit you're right.

i dont need to insert the field data into a regexp, i have the logic if step to do that. i extract the entire text without regex and do an if with it.

sometimes i completely blank out my logic

thanks!
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)