Any Idea?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 1
- Joined: Thu May 15, 2025 3:06 am
- Contact:
Any Idea?
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!
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!
Re: Any Idea?
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
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
Re: Any Idea?
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
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
Re: Any Idea?
To open a file, use the launch command.
Here is a sample script (I put the file is my Public folder).
This should work.
Bob
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
Bob
Re: Any Idea?
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 (?)
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 (?)
Re: Any Idea?
Well then how about trying:
instead?
Bob
Code: Select all
start using stack "myStack"
Bob
Re: Any Idea?
No, that won't do it either.
I think your comment about put the text into a field is correct:
That should give the OP what is needed.
Bob
I think your comment about put the text into a field is correct:
Code: Select all
put URL(“file:” & <filepath>)
Bob
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Any Idea?
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.
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn