app acts different in livecode than as standalone app

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

Post Reply
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

app acts different in livecode than as standalone app

Post by sms5138 » Thu Apr 28, 2016 3:48 pm

Hi everyone,

I have a bit of a conundrum. I've made a simple little application that takes a text file, and does a simple find/replace on the text file.

the application works perfectly when i run it in livecode, but doesn't seem to do anything when i run it as a stand alone application?

i'm at a loss here, and wondered if anyone has had this issue.

It was working fine, but not anymore. I will say I did make one change (the location of the icon for the standalone in the was moved, but I don't think that'd be enough to break it?), but once the issue popped up I moved it back. That didn't seem to fix the problem though...

I've attached the project here, and wondered if anyone who had a moment could try to make a standalone build, and replicate the issue?
When you convert the attached .txt it should change it from abc to 123, and def to 456.
confusingIssue.zip
this contains the .livecode and .txt files
(145.57 KiB) Downloaded 271 times
It won't find the .csv file that is used to update the datagrid, but the datagrid still contains the information needed to find/replace.

It's possible that I'm missing something, but I've got to be honest... i'm not sure what it is?

Thanks in advance for any help you can provide.

-Sean

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: app acts different in livecode than as standalone app

Post by ghettocottage » Thu Apr 28, 2016 5:42 pm

I had a quick look but did not see where you have your script for updating the text file. ..but I imagine your issue is with the file-path.

Where is the code that updates the txt file?

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: app acts different in livecode than as standalone app

Post by sms5138 » Thu Apr 28, 2016 6:54 pm

Hey thanks for taking a look.

My apologies. The convert/convert all buttons show up after you've selected the file. when you rename the file it does in fact create a new file, but the file is unchanged.

here's the code i have for the convert buttons:

Code: Select all

global gFiles, gOK, gEmpty
on mouseUp
   /*if fld "listAll" is not empty then
   repeat with h = 1 to the number of lines of fld "listAll"
      if line h of fld "listAll" is not empty then 
         put line h of fld "listAll" into tName
         put url("file:" & tName) into tResponse
         answer tResponse
      else 
         put "line " &h&& "is empty" into fld "status"
      end if
   end repeat
else
   put fld "path"  into tName
   put url("file:" & tName) into tResponse
   answer tResponse
end if*/

if fld "listAll" is empty then
   
   put fld "path" into tName
   put url("file:" & tName) into tResponse
   --answer tResponse
   
   repeat with h = 1 to 2000
      
      if the dgDataOfLine[h] of group "compare" is not empty then 
         put the dgDataOfLine[h] of group "compare" into theDataA
         put theDataA["wa"] into theSearch
         put theDataA["gdot"] into theReplace
         --answer "wa:"&&theSearch && "gdot:"&& theReplace
            replace theSearch with theReplace in tResponse
            --answer tResponse
      else
         put tName &&"is 100% complete at:" &cr& the short time && the short date into fld "status"
      end if
      if h = 1 then
         put tName &&"is 1% complete" into fld "status"
      end if
      if h = 13 then
         put tName &&"is 13% complete" into fld "status"
      end if
      if h = 25 then
         put tName &&"is 25% complete" into fld "status"
      end if
      if h = 49 then
         put tName &&"is 50% complete" into fld "status"
      end if
      if h = 62 then
         put tName &&"is 62% complete" into fld "status"
      end if
      if h = 75 then
         put tName &&"is 75% complete" into fld "status"
      end if
      if h = 95 then
         put tName &&"is 95% complete" into fld "status"
      end if
   end repeat
   

      --put mk_setprefs(tPrefs) into tResult
      --answer tName
      ask question "Would you like to rename this file?"with tName titled "Do you want to overwrite?"
      put it into tAnswer
      put tResponse into url("file:" & tAnswer)
      --answer tName&&"has completed converting." 

   
else 
   
   
   repeat with c = 1 to the number of lines of fld "listAll"
      if line c of fld "listAll" is not empty then 
         put line c of fld "listAll" into tName
         put url("file:" & tName) into tResponse
         --answer tResponse
         
         repeat with h = 1 to 2000
            if the dgDataOfLine[h] of group "compare" is not empty then 
               put the dgDataOfLine[h] of group "compare" into theDataA
               put theDataA["wa"] into theSearch
               put theDataA["gdot"] into theReplace
               --answer "wa:"&&theSearch && "gdot:"&& theReplace
                  replace theSearch with theReplace in tResponse
                  --answer tResponse
            else
               put tName &&"is 100% complete at:" &cr& the short time && the short date into fld "status"
            end if
            if h = 1 then
               put tName &&"is 1% complete" into fld "status"
            end if
            if h = 13 then
               put tName &&"is 13% complete" into fld "status"
            end if
            if h = 25 then
               put tName &&"is 25% complete" into fld "status"
            end if
            if h = 49 then
               put tName &&"is 50% complete" into fld "status"
            end if
            if h = 62 then
               put tName &&"is 62% complete" into fld "status"
            end if
            if h = 75 then
               put tName &&"is 75% complete" into fld "status"
            end if
            if h = 95 then
               put tName &&"is 95% complete" into fld "status"
            end if
         end repeat

            ask question "Would you like to rename this file?"with tName titled "Do you want to overwrite?"
            put it into tAnswer
            put tResponse into url("file:" & tAnswer)

      end if
      
   end repeat
end if

end mouseUp

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: app acts different in livecode than as standalone app

Post by ghettocottage » Thu Apr 28, 2016 8:51 pm

Sorry, I ran out of time. I played with your stack a little and was having the same issue you described.

One thing I noticed:

Open stack
Use the Convert Button
...everything works fine

Save as standalone..but dont open the standalone yet, just staying on the stack
Use the Convert Button
...does not work

But if you close the stack and re-open, it works again

Something seems to be happening during the save as standalone..some variables get messed up perhaps? I have to go now. Sorry I could not help more.

Post Reply