How to save project on runtime? - livecode

I want to save a project on runtime with extension type ".livecode". Is it possible?
Here is an example:
on mouseUp
save stack "testStack"
end mouseUp
I tried this suggestion:
In the "Standalone application settings" in LC under "Stacks" enable
"Move substacks into individual stackfiles". With this option enabled
you can save the substacks from within the standalone.
And I create substack "testsub" in the mainstack.
In the mainstack, I create a button to save the substack. Here is the code:
on mouseUp
save stack "testsub"
end mouseUp
It doesn't save the file.

You can only save substacks. Not the standalone itself.
To save substacks you need to adjust your standalone settings in livecode.
In the "Standalone application settings" in LC under "Stacks" enable "Move substacks into individual stackfiles". With this option enabled you can save the substacks from within the standalone.
Lets say your standalone contains a main stack called "main" and a substack called "preferences".
You can then save the substack with save stack "preferences" and the stack is saved back to disk.
You can even save the stack from a script in stack preferences itself. save this stack
But as written above, this will only work if the substacks are in seperate stackfiles.
The main stack cannot be saved.

Probably, you can't do what you want, because LiveCode doesn't have permission to write to the application folder (if you're running the app from the application folder). Write the modified stack to the preferences folder or simply to the documents folder and you'll be able to save modifications.

Related

In Windows 10 how do I add a program to the main "Open With" menu not "Choose another App"

With Windows 7 I could easily use the Open With context menu to add a new program which would thereafter appear in the Open With menu (I can't remember the exact sequence, but it was easy and worked fine). However I have now upgraded to Windows 10. The programs that I associated with my particular file extension in W7 still appear in the Open With menu in W10. If I want to add another one I select "Choose Another App". However, any app I add with W10 does not appear in the Open With menu - I have to select Choose Another App every time to get to it. I now have two lists of available apps, one in Open With (the ones I set up with W7) and one in Open With | Choose Another App (the ones I set up with W10). It's not exactly a show stopper but it's irritating. Does anyone know what this is all about and how I can get the apps into the main Open With menu?
The reason why it doesn't appear in "Open with" menu is most likely because application's VERSIONINFO is not properly filled out with all the relevant details. If you are application developer you should create VERSIONINFO resource as clarified here:
https://learn.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource
If you are not the developer, then you can still fix this by editing registry - see here:
https://superuser.com/questions/1199648/strange-open-with-list-inconsistent-with-registry/1256482#1256482
Basically under the registry key: Computer\HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache there should be 2 keys for YourExampleApp:
One that ends with .FriendlyAppName
One that ends with .ApplicationCompany
For example:
C:\Program Files (x86)\ExampleApp\YourExampleApp.exe.FriendlyAppName
C:\Program Files (x86)\ExampleApp\YourExampleApp.exe.ApplicationCompany
Most likely one of these 2 is missing which causes the application to be dropped out of the "Open with" menu.
The MuiCache list is cached from the properties of the application's VERSIONINFO resource embedded in the application, so if such resource is missing from the application, some items may be missing from the cache as well. For more details have a look at the above references.
Coder12345 had the correct answer for me, thanks a ton! I would like to expand on it briefly; I wanted Shotcut to appear in the first open with... context menu. I had to add the registry entry for ApplicationCompany. It appears that it doesn't matter what you put for the value of that key, just as long as it's there. No restart of file explorer was required, the change takes place immediately.
Also, the FriendlyAppName changes what text appears in the open with submenu. Shotcut appeared as shotcut.exe so I changed it to just Shotcut.

Saving the REDHAWK SDR IDE Chalkboard

Is there a way to save the current chalkboard to allow you to reuse it later? I can perform a Save As, but that saves it as a waveform. If I don't save it, the chalkboard disappears when I close REDHAWK IDE.
Technically, the short answer is no. There is no way to save an instance of the Chalkboard and reload it into the Chalkboard.
What you may want to do, is save the Chalkboard as a waveform using File->Save As. Then, you may "Launch a Local Waveform" from the Overview tab of the Waveform Editor. This will launch the waveform within the Sandbox, essentially making a new Chalkboard instance that you may interact with in the same way as the Chalkboard, including the ability to modify and resave the the current Sandbox instance as a new waveform to repeat the process.
One final thing to keep in mind, the Chalkboard/Sandbox does not set an Assembly Controller so once you are done and want to run this waveform within the Domain, you'll need to designate an Assembly Controller or else you will get an error on launch.

How can I set a file association from a custom file type to a program

Let's say I make a custom file that actually corresponds to what my program can read called "Bacon.dek". I can access it, modify it, etc. normally from my program, with only a few problems staying alive (fixing them at a relatively correct speed, too).
Now, what I wanna do (and try to fix rather quickly once done), is actually choosing my file from Windows Explorer, right-clicking on it, and choose "Open with..." and choose my application.
Or simply set my application as the default application to simply double-click it and it would open in my app? Like, I double-click "Bacon.dek", and it opens "Eggs.exe", reading "Bacon.dek"?
Basically you have to do this -
In registry add these keys
[HKEY_CURRENT_USER\Software\Classes\dekEditor\shell\open\command]<br/>
#="c:\path\to\app.exe \"%1\""<br/>
[HKEY_CURRENT_USER\Software\Classes\.dek]<br/>
#="dekEditor"<br/>
This is a 2 step task.First you associate your extension .dek with dekEditor (2nd entry) and then specify it in Classes(1st entry).
Answer taken from: Create registry entry to associate file extension with application in C++
MSDN Article.

SDL in Visual C++ - where to properly put images used in the program?

I'm just learning SDL and I would like to know where is the correct place to put images and other file stuff in?
I use Visual C++ 2010 Express and the problem is that when I compile a program and start it straightly from IDE, it instantly stops because it can't load images. But when I start it by clicking on it in Release/Debug folder, where these images are placed, it is, of course, OK.
It seems that the IDE starts the program from another path than Release/Debug folder.
My question is - how shall I deal with it? Is there a way of setting the location of images directly in Visual C++? I'm asking this question because when I'm unable to start the program from IDE -> I can't use that IDE's debugger.
I hope I explained my situation well enough and thanks for the answers.
If you click on your project with the right mouse button, select properties, on the window that opens, click on "Debugging", notice the entry "Working directory", put there the directory where you want your program to run.
I am used to create a folder called work and put images, sounds, etc, there and configure the working directory to use this folder.
Also, any dlls not in system path must go there for your program to find it or in the same folder where visual is creating your exe.
Also on the same window, you will see the "Environment" entry, you can use it to configure path to dlls if neeeded setting the PATH environment variable, like for example:
PATH=c:\mylibs\dlls\

MFC feature pack - Couldn't show the dockable pane once closed

By using the wizard, and selecting Office 2007 style, you can come up with a UI that looks like an IDE - a dockable file explorer pane on the left, and a dockable properties pane on the right.
However, when you close these dockable panes, there's no way you can show them again. Even if you recompile the project.
I searched through some forums and looks like I'm not the only one having this problem. Is there any way to show these panes again?
These settings are stored in registry. I have created a project named "office2007", in the generated wizard file office2007.cpp there is a line which sets the settings path in registry: SetRegistryKey(_T("Local AppWizard-Generated Applications"));
The path in registry where the settings for office2007 are stored is: HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\office2007
If you want to have the initial state of the panes you should delete the registry key: HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\office2007\Workspace
If you don't want to delete your registry settings everytime, you can also add this line
m_bSaveState = FALSE;
to your CWinAppEx. It'll stop saving the state of your panes and reinitialize them every time the program opens.

Resources