Search found 492 matches

by kaveh1000
Sun Nov 28, 2021 9:59 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

Thanks Jaqueline. From what I understand if I use it immediately after say a function all I should be ok, no?
by kaveh1000
Sat Nov 27, 2021 4:31 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

Point taken. "it" is so cute though and I keep forgetting not to use it. ;-)
by kaveh1000
Sat Nov 27, 2021 3:28 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

Hi Richard The problem here is that I am dragging a file into a field. Allowing multiple files would be confusing. So it is quite logical to say you cannot drag multiple files. I am now using: on dragdrop get dragData["files"] if the number of lines of it > 1 then answer "Please drag in only one fil...
by kaveh1000
Fri Nov 26, 2021 10:16 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

Thanks Klaus. just wanted to ensure I understood right. :-)
by kaveh1000
Fri Nov 26, 2021 9:59 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

So am I right that you want to ensure only 1 file is acted on, in case user drops more than one file? In that case would it not be better to warn the user rather than take one of the files, namely the first one in the list?
by kaveh1000
Fri Nov 26, 2021 5:52 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

You know something? That is exactly what I had! Must have been advice from you years back. I could not understand it so changed it and it worked.

Could you kindly explain what is going on there? Why would there be more than one line and why do we take the first line?
by kaveh1000
Fri Nov 26, 2021 5:22 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Re: Drag and drop Unicode file

You are a genius Klaus! First of all, apologies. I copied wrongly. This is what I was using: on dragdrop put URL ("file:" & dragData["files"]) into fld "original" end dragdrop Now I use this which works. :-) on dragdrop get URL ("file:" & dragData["files"]) put textdecode(it,"UTF8") into fld "origin...
by kaveh1000
Fri Nov 26, 2021 5:00 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Drag and drop Unicode file
Replies: 18
Views: 6274

Drag and drop Unicode file

I am dragging and dropping a text file into a field using:

Code: Select all

on dragdrop
   put  dragData["files"]
end dragdrop
Works fine except it does not convert not ascii chars like ö. What is the solution?
by kaveh1000
Thu Nov 25, 2021 6:40 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

Hi Jacque Here I am just trying to find the offset (start and end) of a piece of text (represented by a regular expression). I am not trying to replace it. replacetext will replace the found chunk with something else that I define. Oh, if you are referring to the last note about no replace option in...
by kaveh1000
Wed Nov 24, 2021 5:10 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

This one can be done without regex, but at times it can get very complicated and far easier with regex.

And a rant here that a major shortcoming of LiveCode is that it can search for regex but it cannot replace regex. A gap that has been filled with SunnYrex by @thierry. Works great.
by kaveh1000
Wed Nov 24, 2021 2:22 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

Ah, but I have varying text, so e.g. in the following XML text: <Measure> <MeasureType>08</MeasureType> <Measurement>2137</Measurement> <MeasureUnitCode>gr</MeasureUnitCode> </Measure> <Measure> <MeasureType>01</MeasureType> <Measurement>234.0</Measurement> <MeasureUnitCode>mm</MeasureUnitCode> </Me...
by kaveh1000
Wed Nov 24, 2021 1:34 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

@Bernd: But MatchChunk is specifically for regex I think. ;-)
by kaveh1000
Wed Nov 24, 2021 11:24 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

Going further,

Code: Select all

on mouseup
   get matchChunk("Hello", "(el).*(o)", tOne, tTwo, tThree, tFour)
   answer tOne && tTwo && tThree && tFour
end mouseup
produces

Code: Select all

2 3 5 5
by kaveh1000
Wed Nov 24, 2021 11:20 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

OK, I got it. We need to grab the item we are interested in with brackets. so:

Code: Select all

on mouseup
   put empty into tStart; put empty into tEnd
   get matchChunk("Hello", "(e)", tStart, tEnd)
   answer tStart && tEnd
end mouseup
returns

Code: Select all

2,2
by kaveh1000
Wed Nov 24, 2021 10:31 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Simple MatchChunk question
Replies: 18
Views: 5888

Re: Simple MatchChunk question

From what I remember, this should be looking at the offset of "e" inside "Hello", so tStart should return as 2.

Go to advanced search