ScriptSpot

Forum topic · General Scripting

finding an unknown part of the name, etc.

By yunusbbayram · 2011-09-10

Description

		secimname = $'Kontrol_yüz kontrol textsR001'.name as stringstream
		secimisim=#()
		count=1
		
		while not eof secimname do
		(
		secimisim[count]=readchar secimname
		count +=1	
		)
		atoplam = secimisim.count - 22
		askon=#()
		askon[atoplam+1]=(secimisim[secimisim.count-2] as integer)
		askon[atoplam+2]=(secimisim[secimisim.count-1] as integer)
		askon[atoplam+3]=(secimisim[secimisim.count] as integer)
		for o in 1 to atoplam do
		(
		askon[o]=(secimisim[o] as string)
		)
		
		askontoplam=for i in 1 to atoplam collect askon[i] as string
			
		askona = (
(askontoplam as string)+"_yüz kontrol textsR" + (askon[atoplam+1]as string + askon[atoplam+2] as string+askon[atoplam+3] as string)
                          )
		askona	

output : "#("K", "o", "n", "t", "r", "o", "l")_yüz kontrol textsR001"
but I want to like it: "Kontrol_yüz kontrol textsR001"

Comments (4)

yunusbbayram · 2011-09-11

thank you

!?...

Anubis · 2011-09-11

I can't catch the meaning of this question...
as your example start and end with no changes:

"Kontrol_yüz kontrol textsR001" -- our object name
"Kontrol_yüz kontrol textsR001" -- our wanted result

They equal!

theObj.name

, nothing for search in this task?...

As for "finding an unknown part of the name" --
If you search for a part of the name,
then here is 2 examples:

obj = box name:"Happy New Year"
oName = obj.name

-- if need boolean test, use matchPattern
matchPattern oName pattern:"*new*" -- true
matchPattern oName pattern:"*hey*" -- false

-- if need the position of the string...
findString oName "new" -- 7
findString oName "hey" -- 0 (== not found)

raphick · 2011-09-11

Hi! Try this one :

askona = "";
for letter in askontoplam do askona += letter;
askona += "_yüz kontrol textsR" + askon[ atoplam + 1] + askon[ atoplam + 2] + askon[ atoplam + 3];

[Edit]Oops sorry for double answer;

kilad · 2011-09-11

name = ""
for i in askontoplam do name += i

askona = name +"_yüz kontrol textsR" + ....