Hi MS’s,
I’m sorry to bother you with this, becuase i know that you have helped lots of other people with (almost) the same problem i have right now. I always that i had progressed far enough not to run into these basic AS problem anymore… Apperently not. So, will you please help me with my problem?
So, i wrote a script that currently does all kinds of interesting thing but all the coding hangs around this simple thing:
I need to extract a specific sentence from a text file. The text file will always follow the same ‘rule’:
the text file currently contains about 50 ‘entries’ which should be put in a variable by my script. The problem is that whatever i do, it will always extract the second sentence from my file
the coding to read out the file is already done, after that a subroutine is called with a parameter var1, var2 and on.
on dd_(x) -- where x would be the parameter
log "Input: " & x
set AppleScript's text item delimiters to (x & " : " as text)
set TXTLT to TXTLT as text -- Where TXTLT would be the content of the file.. in text
set step1 to text item 2 of TXTLT
log "Output: " & step1
return step1
end
so when i call dd_()
dd_("Var3")
it should reply “Var3 : It’s over 9000!” instead, no matter what parameter i enter i get “Var2 : And it was 11 o’clock, which was time for a little something”.
Does anyone know what i am doing wrong? everything i do seems to return var2 as a result…
I’m confused >.<
Model: Macbook Pro9,1
AppleScript: 10.8
Browser: Safari 537.36
Operating System: Mac OS X (10.8)