Any Idea?

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
lewisbaggins
Posts: 1
Joined: Thu May 15, 2025 3:06 am
Contact:

Any Idea?

Post by lewisbaggins »

Hi everyone,
I'm currently working on a project in LiveCode on Windows 10, targeting a desktop application, and I've encountered what seems to be a bug. Specifically, when I try to open a file using the open file command, the application either freezes or returns an error stating that the file cannot be opened, even though the path is valid and the file exists. To reproduce the issue, I create a button that runs a script to open a text file located in the Documents folder. I use open file "C:/Users/MyUser/Documents/t***.txt" for read, but as soon as the script executes, LiveCode hangs or throws an error. I expected the file to open normally so I could read its contents into a field, but instead the app becomes unresponsive or fails to access the file. I’ve double-checked file permissions, tested with different paths and file names, and even tried running LiveCode as administrator, but the problem persists. Has anyone experienced this or found a workaround? Any help would be greatly appreciated. Thanks in advance!
stam
Posts: 3209
Joined: Sun Jun 04, 2006 9:39 pm

Re: Any Idea?

Post by stam »

You should probably post the actual code used.

Most of us would not use the open file command (which should be followed by for <action> (such as read/write/append).

If you just want to put a text file into a field the use the put URL(“file:” & <filepath>) command
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Any Idea?

Post by dunbarx »

What Stam said.

I am not a Windows user, but please do post the relevant code. And does this work OK with a different version of Windows?

Craig
bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 175
Joined: Tue Feb 23, 2010 10:53 pm

Re: Any Idea?

Post by bobcole »

To open a file, use the launch command.
Here is a sample script (I put the file is my Public folder).

Code: Select all

on mouseUp pButtonNumber
   launch document "/Users/myName/Public/Test.txt"
   
   --Or, try something like this:
   --launch "/Users/myName/Public/Test.html" with "/Applications/Safari.app"
end mouseUp
This should work.
Bob
stam
Posts: 3209
Joined: Sun Jun 04, 2006 9:39 pm

Re: Any Idea?

Post by stam »

Think the OP wanted to open a file for use within LiveCode(?)
If it’s just opening the file with the system default app then yeah, that’s it.
But don’t think that’s what the OP was asking for (?)
bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 175
Joined: Tue Feb 23, 2010 10:53 pm

Re: Any Idea?

Post by bobcole »

Well then how about trying:

Code: Select all

start using stack "myStack" 
instead?
Bob
bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 175
Joined: Tue Feb 23, 2010 10:53 pm

Re: Any Idea?

Post by bobcole »

No, that won't do it either.
I think your comment about put the text into a field is correct:

Code: Select all

put URL(“file:” & <filepath>)
That should give the OP what is needed.
Bob
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Any Idea?

Post by FourthWorld »

Lengthy blocks of unformatted text mixing code and description from an account created hours before this first and only post may be a human behavior, but is frequently what bot behavior looks like.

Dear OP: add some meaningful line breaks to your post and I'll help. Ignore this request long enough and I'll delete this thread, since of course by that time you clearly wouldn't need an answer anyway.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Erica M. Funk
Posts: 1
Joined: Mon Aug 11, 2025 5:19 am

Re: Any Idea?

Post by Erica M. Funk »

Hey there! I've run into similar snags with LiveCode on Windows before. Have you tried using the specialFolderPath function to construct the path? It's sometimes more reliable than hardcoding. Also, weird question, but is there anything unusual about the file name itself? Maybe some hidden characters? This sounds like something that could drive anyone crazy. The troubleshooting reminds me of trying to get that wacky Eggy Car game to run properly on an old computer, haha! Good luck!
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Any Idea?

Post by FourthWorld »

Erica M. Funk wrote: Mon Aug 11, 2025 5:24 am Hey there! I've run into similar snags with LiveCode on Windows before. Have you tried using the specialFolderPath function to construct the path? It's sometimes more reliable than hardcoding. Also, weird question, but is there anything unusual about the file name itself? Maybe some hidden characters? This sounds like something that could drive anyone crazy. The troubleshooting reminds me of trying to get that wacky Eggy Car game to run properly on an old computer, haha! Good luck!
What are you building with LiveCode?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Post Reply