Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
Whytey
- Posts: 31
- Joined: Fri Jan 10, 2014 6:40 pm
Post
by Whytey » Mon Jan 13, 2014 9:24 pm
Yes I think I'm going to need some help with that too
So right now I have
Code: Select all
on mouseUp
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
put word tStart to tEnd of tText into aFound[x]
add 1 to x
add tEnd to tSkip
end repeat
end mouseUp
Is that all looking good then, I've just changed where my text is located, "Results2" and the lookup function, on mouseUp. So I've made 5 text boxes called box 1-5 Yes if you could help me put the results into these boxes that would be amazing!
Thanks Jacque!!

-
Whytey
- Posts: 31
- Joined: Fri Jan 10, 2014 6:40 pm
Post
by Whytey » Mon Jan 13, 2014 9:29 pm
Hi Jacque,
In my "Results 2" box that number appears on a separate line as in
Select item 244094151.
Cloning of Soluble Human Stem Cell Factor in pET-26b(+) Vector.
Asghari S, Shekari Khaniani M, Darabi M, Mansoori Derakhshan S.
Adv Pharm Bull. 2014;4(1):91-5. doi: 10.5681/apb.2014.014. Epub 2013 Dec 23.
PMID:
24409415
However in pubmed the number is right next to word PMID.
Hope that clears things up?
-
Whytey
- Posts: 31
- Joined: Fri Jan 10, 2014 6:40 pm
Post
by Whytey » Tue Jan 14, 2014 6:22 pm
Hi all,
Still having some problems with getting my entries into the five boxes. I now have
Code: Select all
on mouseUp
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
put word tStart to tEnd of tText into field "Box1"
add 1 to x
add tEnd to tSkip
end repeat
end mouseUp
Could you tell me where I am I going wrong? Thank so much for all your help so far!

-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Tue Jan 14, 2014 6:50 pm
Hi Whytey,
Code: Select all
on mouseUp
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
## You need to create the names of the target fields inside of the repeat loop:
put word tStart to tEnd of tText into field ("Box" & x)
add 1 to x
add tEnd to tSkip
end repeat
end mouseUp
Best
Klaus
-
Whytey
- Posts: 31
- Joined: Fri Jan 10, 2014 6:40 pm
Post
by Whytey » Tue Jan 14, 2014 8:15 pm
Hi Klaus,
Thank you so much I've attached a jpg maybe that will help, do we need to say stop if x>5 as i keep getting an error and there's nothing going in the boxes yet......
The boxes are called Box1, Box2, Box3, Box4 and Box5
The code is all behind the go button and is
Code: Select all
on mouseUp
searchForums
put fld "Results2" into tText
put 0 into tSkip
put 1 into x
put the number of words in tText into tLength
repeat
put wordoffset("Select",tText,tSkip) + tSkip into tStart
if tStart >= tLength then exit repeat
put wordoffset("PMID:",tText,tSkip) + tSkip into tEnd
## You need to create the names of the target fields inside of the repeat loop:
put word tStart to tEnd of tText into field ("Box" & x)
add 1 to x
add tEnd to tSkip
if x>5
end repeat
end mouseUp
command searchForums
set the htmlText of field "Results2" to URL ("#pubmed database (I can't post the link)" & urlEncode(the text of me))
end searchForums
I'm not sure what is going wrong?? I've already burnt a cake and some flapjacks this week trying to figure this out!!

-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Tue Jan 14, 2014 8:38 pm
We need to know what the error is. The text in the screenshot doesn't match the data you posted, or at least, not the part that's visible so that may be the reason.
Also, if you know that you want exactly 5 results only then you can change the repeat loop to specify 5 repeats:
repeat with x = 1 to 5
and remove the lines that initialize x and add 1 to it. I'll leave that as an exercise for you. When we know what error you're seeing then we can look at that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
Whytey
- Posts: 31
- Joined: Fri Jan 10, 2014 6:40 pm
Post
by Whytey » Wed Jan 15, 2014 8:00 pm
Hi Jacque, thank you so much for your message I've simplified the app a little so don't have that problem anymore think its a little beyond my abilities at the moment. Just a couple of questions 1) I've noticed that the search works just fine when I am on my laptop and press the return key however on the mobile this does not work, my code is
Code: Select all
on returninField
searchForums
put fld "Results2" into tText
put wordoffset("Results:",tText) into tStart
put wordoffset("[Pubmed]",tText) into tEnd
put word tStart to tEnd of tText into fld "box1"
end returninField
command searchForums
set the htmlText of field "Results2" to URL ("http://www.ncbi.nlm.nih.gov/pubmed/?term=" & urlEncode(the text of me))
end searchForums
returninField
Will I need a search button like google to do this on the mobile as just pressing return doesn't seem to work? If so how would I go about linking my code in the text box to the button?
Thank you for your help!
-
Whytey
- Posts: 31
- Joined: Fri Jan 10, 2014 6:40 pm
Post
by Whytey » Wed Jan 15, 2014 8:27 pm
Just figured it no worries
