How to create a .vm (velocity template file) from command line in Windows? - windows

How to create a .vm (velocity template file) from command line in Windows

Based on you comment I assume what you really mean is how to made file which by default opens with some specific program you have. Here is several thing to be taken into account:
To create .vm file from command line you can use this question
By default windows doesn't show file extensions in explorer - so you won't actually see that it is .vm file in explorer. Reffer this guide to show file extensions.
There is such thing as file associations - e.g. default program to be use when you open file (for example double click). Also this affect icon shown for the file in explorer.
So to summarize - file created from command line(using method from referred question) have .vm extension. You don't see this cause your windows settings doesn't show extensions. You assume it is text file cause notepad++ icon shown for it as well as it opens with notepad++. That's a wrong assumption - simple you have notepad++ associated to open .vm files. If you want to use different program - you need either:
Change file associations (see link above).
Use open with option to open file with another program (right click menu option)
Use Open function from inside your program.

Related

How to create .lisp files and run them on mac?

As can be seen on the picture TextEdit on mac gives only limited options of file extensions in which I can safe a file. Lisp not included.
Create .lisp files
https://www.tutorialspoint.com/lisp/lisp_environment.htm is describing everything step by step, but it says TextEditor on Mac can save .lisp files, which I wasn't able to do.
Load .lisp file
(load "filename.lisp") leads to error: file with such name doesn't exist
TextEditor on mac has limitations to how file can be saved (.txt, etc.). You can use any other editor, ex: TextWrangler, which allow you to write file extension. Or you can use editors specific for lisp, ex: Emacs (more massive)
It's possible that when you type (load "filename.lisp") it searches in some specific directory, where it's not present. So, to avoid this, you should type full path to the file you want to open. Ex: (load "/Users/macbook/Desktop/foldername/filename.lisp")

How can I open a Microsoft Access Database file with an .exe?

I have been working on creating a pretty advanced GUI enabled database in Microsoft Access and am now in the implementation phase of my project.
My dream is to make an .exe file that will point to the actual .accdb database file (which will be hidden) as I cannot change the icon of the .accdb but will be able to modify the .exe's icon thus giving my implementation a more professional feel.
I'd prefer not to just create a shortcut to the .accdb and change that icon.
Through some quick digging, my plan was to create a .bat file that opens the .accdb and then use some online ".bat to .exe" converter to then add an icon to the .exe.
I can't figure out how to create a .bat file that opens my .accdb. I've tried a variety of different things like:
start "" C:\Program Files (x86)\CompassTrack "Science Department.accdb"
and other things that dont work.
It occurred to me that a .bat to .exe approach may not be the best way to do this. I don't particularily like the brief command prompt window appearance and would be open to any suggestions as to how to get a nice looking .exe file to open my .accdb.
If the best way really is a .bat file, I'd appreciate some help with the .bat file. The path to the file is C:\Program Files (x86)\CompassTrack\Science Department.accdb but for some reason every time, command prompt would return "Cannot find C:\Program "
Thanks in advance!
to change icon of an exe file using batch, look here
and to start your file use:
cd "C:\Program Files (x86)\CompassTrack"
start "" "Science Departement.accdb"
I believe you can just change the icon of your Access database. Go to Current Database (in recent versions under Office Button > Access Options) and the option is in there.
Here's a really simple C# program that you can compile into an exe very easily to if you have .NET 3.5 installed. it uses a utility called the command line compiler. You'll have to change the file path obviously.
using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
public class App
{
public static void Main(string[] args)
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = #"c:/your_file_path_goes_here/YourDB.accdb";
myProcess.Start();
}
}
You'll write the above to a text file with the extension .cs. Then create a batch file (a text file with the extension .bat) with this code.
#echo OFF
echo Compiling A File . . .
C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe /win32icon:_.ico /target:winexe /recurse:*.cs
echo.
#pause
Put these in the same dir as whatever icon you want to use, but make sure the icon is an iso file named _, as seen in the batch program. When you run the bat file, it will create the exe with the icon of your choice and it will simply launch the access database.
The feature and ability is part of the Access development system. Attempting to modify some .exe file etc. will not work.
I do suggest that you set the icon under file->options current database. It not clear why this is not working (perhaps start a new question to resolve that issue).
Keep in mind that if you deploy or change the resulting location, then you have to change the above “options” setting (manually, or by code – this much explain why your icon is not displaying – the path name cannot be relative – must be absolute.
ALSO select the box that says to use the icon for all forms and reports (this will give your application a MUCH more polished look. Since the .exe that actually runs your file is msacces.exe, then you can’t really change the application icon any other way. You see icons for the application AND ALSO forms like this "when" you set the application icon as per above:
So you WILL want to set the application icon. You then create a shortcut on your desktop. And again set the icon for that windows shortcut (it will nicely show up in the task bar with that icon).
The actual shortcut will look much like this:
"C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE"
"c:\RidesDev\SkiRides\ RidesXP.accde" /runtime
The above shortcut will be on a single line (space between the two lines). The above is for Access 2010, so for 2013, then the folder is office15, and for 2016, it is office16 in above.
Also NOTE very important is the /runtime. This will ensure that the access icon NEVER shows during start-up.
Also, during start-up you will often see the MS Access splash logo during start-up. E.g. this:
You can replace this splash screen by placing a .bmp (picture) file in the SAME folder as the accDE with the same name.
So in above, if I place a RidesXMP.bmp picture file, then during start-up in place of the access splash screen, you see this:
Since you likely want the forms + reports icon to be custom, then the above makes the most sense. Your approach would ONLY give you a desktop icon, not one for the task bar, forms etc.
The above will result in hiding the access splash logo during start-up, and also apply an icon to all forms etc. I don’t suggest some approach that attempts to modify some .exe or some such – that’s likely to cause issues on customers computers. And using some .exe will not give you the icon for forms and repots.

Add a Windows Shell context menu entry for a specific extension (not file type)

To add a Windows shell context menu, let's say for .txt files - if the .txt extension in HKEY_CLASSES_ROOT (or in HKEY_CURRENT_USER\Software\Classes, doesn't really matter) has the default value (file type) txtfile - you add the command to HKEY_CLASSES_ROOT\txtfile\shell\yourcommand (and the command itself in HKEY_CLASSES_ROOT\txtfile\shell\yourcommand\command, of course) and there you go.
However, let's say the .txt extension instead has the default value Notepad++_file. Notepad++_file might be the file type for many other extensions, so if you add the command to HKEY_CLASSES_ROOT\Notepad++_file, then this command will appear for every extension associated with Notepad++.
So, the question is: how can you add a menu entry for ONLY ONE specific EXTENSION, without changing its file type, if possible at all?
P.S.: I don't want to just duplicate the file type, because future changes to the original file type won't affect the duplicated one.
Here you go:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\your custom app]
#="Open with your custom app"
"icon"="C:\\Windows\\notepad.exe,0"
"AppliesTo"=".nfo"
[HKEY_CLASSES_ROOT\*\shell\your custom app\command]
#="C:\\Windows\\notepad.exe \"%1\""
The line "AppliesTo"=".nfo" does the trick.
Works perfectly on Windows 10.
It works per file extension, regardless if there is an application associated with that extension or not. Doing this way it less invasive and leaves a very small footprint in the registry.
Compare to Add menu item to windows context menu only for specific filetype
Edit:
If you want to apply that command to more than one extension use:
"AppliesTo"="System.FileName:\"*.nfo\" OR System.FileName:\"*.log\""
Credit: https://superuser.com/questions/183785/windows-7-context-menu-for-folders-if-folder-contains-certain-filetypes

Textmate, open file at Caret

I bet this is really obvious but I can't find how to open the linked file that the Caret is currently on in Textmate. For example in the likes of Dreamweaver you can click in the index.html portion of <a href"index.html" hit cmd-D and it opens this file in a new tab. Is this possible?
Would also be good to do this with <img src="image.jpg" to open the file directly into Photoshop.
Solved!
Solution for Patrick below.
I used a modified version of Daustin777's example above to create a Command called OpenatCaret.
The command is: open "$TM_PROJECT_DIRECTORY"/"$TM_SELECTED_TEXT"
I then extended this by installing a macro which allowed you to select a path between double quotes but not including the quotes. I got this from the macromates board here. http://lists.macromates.com/textmate/2009-June/028965.html
To wrap them both together I put my cursor in a path and recorded a new macro where I run the "Select within double quotes" macro and then the OpenatCaret command. I then named this OpenProjectFileAtCaret and bound this macro to cmd-D.
Works a treat and is used all the time. Just make sure you have the correct default apps setup for each file type you are opening eg. Textmate for php, asp, html and it will open them in a new tab.
I don't have a full solution as a linked bundle but this should get you close.
You can use the Bundle Editor to create a command that will open an image if you select the path. Create a new command and enter this:
open "$TM_DIRECTORY"/"$TM_SELECTED_TEXT"
Set Input to Selected Text or Word Set Output to Discard Set Key Equivalent to an unused key combination.
Close the editor. Now you should be able to select an image path and it will open when you press the appropriate keyboard shortcut.
You can add the -a flag to the open command to specify which application to use to open the selected file. This is just a basic example and not an entire solution that will work with every type of file path.
You can get info on Textmate environment variables here.

Expression Web: Shortcut doesn't point to an exe file, but I want to use it to edit

Problem: I have to support users who need to edit web pages. Some of these web pages exist only as textarea controls. Fortunately, there is a firefox plugin that allows the user to open the textarea in a default text editor. Unfortunately, this plugin requires you to point to the EXE file of the text editor you want to invoke.
This is a reasonable requirement, but ##$%^ Microsoft Expression Web is one of those applications whose shortcut .lnk file does not appear to point to a real EXE file. If there is an EXE file somewhere, it's hidden.
Question:
How can I locate the actual EXE file so people can configure Microsoft Expression web to be their editor of choice?
Update: I should have emphasized that I was looking for a way to automate this via script or batch file (hence the SO posting, in case anyone's "not-programming-related" spidey sense was tingling).
I found my executable in the following location:
C:\Program Files\Microsoft Expression\Web Designer\EXPRWD.EXE
I'm not sure if that gives you what you need, but you can always have your users (or programmatically) search for EXPRWD.EXE and go from there.

Resources