Enter Perforce Commands in p4v GUI - version-control

Is there a way to manually enter perforce commands in the p4v GUI?
I'm relatively new to Perforce and find the GUI useful for most of what I need to do, but I can see situations where a one line command would be much easier than navigating through the GUI.
Example:
Opening a file for edit that is nested deep in the source tree; this takes many clicks when done in the GUI but would be a relatively short command with environment variables set for my most commonly used directories.
p4 edit -c NNNNNN $DIRECTORY/file
It would be great if the command entered was also added to the Log window. I really like being able to scroll through the Log to see everything I've done in a session.

The closest that exists right now is "File"->"Open Command Window Here" when you have a file selected in the file browsing pane. It will open a command line in that file's directory with all of the relevant environment set up.
Unfortunately, this won't give you unified Log, and you'll have to juggle a second window.

Related

Using Mobaxterm right-click paste, execute large blocks of pasted code one at a time?

I've been using MobaXterm for a while now, and frequently use right-click paste to execute small blocks of code at the Linux command line or in a Python interpreter. My intention is that each line should be executed one at a time, even if I paste several lines at once. This used to work fine, but recently the application behavior changed and now I have to hit enter after each line. I have checked and "Paste using right click" is checked in the terminal settings menu. Does anyone know how to change this behavior? TIA

Use Powershell to highlight files on an open file explorer window

I've seen how to open a new File explorer, e.g. explorer.exe /select,$path and select files in that new window, but how would I do this with an existing File explorer window, i.e. tell File explorer to select certain files, as if the user had clicked and highlighted those files?
I love Powershell, honestly I use it even when I know another language would be better. But this is no job for Powershell. I don't know to what end, you are "selecting files" in Explorer for, but it may be possible to accomplish your end goal without utilizing the GUI. If for some reason I don't understand you actually want to do what your are asking about in your question, I would use autoit to simulate key presses or clicks.

Matlab : open OS explorer window only if not already open

I'm opening a folder in Windows explorer from within matlab with the following line :
system('explorer.exe /select,./my_folder/my_file.tif');
It works well, even with the relative path for Matlab "current folder" with "./". Note that it also selects the specified file, which is what I want.
However, I would like to open this window only if the same path isn't already open. Right now, I get several copies of the same window and it's annoying. Do you know any way to do this ?
Thanks,
Ghislain
(Windows 8, Matlab R2011b 64bits)
Disclaimer
This is a partial answer. I don't know how to go on from here, but maybe it helps anyways. Your question is quite interesting to me, and it would make data-analysis a lot easier if changing between interfaces (Matlab/Explorer) were easier!
Some History
DDE is an ancient technology (16-bit Windows, yeah!) that enables Windows applications to talk to each other. DDE has been deperecated from Windows XP on, but it simply refuses to die.
One reason for DDE's longevity is that Windows Explorer still uses DDE a lot. For example, when you double-click a file, the Explorer sends a DDE command to Excel, telling it to open that file in the current Excel window.
How DDE might help you
Matlab's DDE support is officially deprecated. Maybe it would have disappeared completely, were it not for the fact that Explorer talks to Matlab via DDE messages!
You can reverse this process by telling initiating a DDE channel to the application "folders" about the topic "appproperties":
channel = ddeinit('folders', 'appproperties')
The "folders" application appears to be a synonym for "progman", the good ol' Windows 3 program manager. You can tell Explorer ("folders") to view a folder by executing
ddeexec(channel, '[ViewFolder("%l", c:\windows, 5)]')
If Explorer already points to that folder, no new window is opened. Unfortunately, I cannot tell you much more about that command. I don't know what that %l is doing there, or the 5 for that matter. The only thing I know is that ViewFolder can be replaced by ExploreFolder, in which case you always open a new window, and that window always shows the folder tree structure on the left pane.
More Information
The most important DDE-related functions are ddeinit, ddeexec, and ddeterm. Their documentation is buried inside the .m files of those functions. You can view the .m files by simply executing
edit ddeinit
Yair Altman has some more info on Matlab's DDE capabilities. What DDE commands are understdood by Explorer evades me. I assembled my example from what I found here.

Recover history MATLAB code?

I have a script named my_script.m, which has been mistakenly replaced by another file with the same name. However, prior to overwriting the script, I have run it in MATLAB console. Hence, I have the following history.
>> my_script
>>
Is there any way to recover that history file?
The reason why I think it is still possible is that I do have the run history of that script in my current console. If only I had selected all the script and run it! That way I would have every command in the console history. But now, it is simply one line as above.
Check if you had diary mode on, then everything is there:
get(0,'Diary')
You can open the file in windows explorer, right mouse button, properties. Then check if there are any other versions of the file in the Previous Versions tab ;)
Sometimes matlab writes backups, the file would be named my_script.asv. Check if it exists, it's located in the same directory.

How to create an Explorer window without Navigation Pane using Shell command Explore

My app Folders Popup is using the command ComObjCreate("Shell.Application").Explore(strPath) to create a new Explorer window. I need a way to tell this new instance of Explorer to comply with the Navigation Pane setting decided by the user (to show or not show the pane) in previous Explorer windows.
Actually, this setting is not taken into account by default in the new instance created by the Shell command and users of my app who prefer to use Explorer without this navigation pane are annoyed to see it reappear when my app is opening a new Explorer. Is there any solution to this (except sending keys to the Explorer, what I prefer to avoid)?
Simpler is sometimes better ;)
The Run command isn't just for executables, it can also open non-executable files like images/documents (as long as their file type is associated) and especially folders:
myFolderPath = C:\Path\To\Folder
Run, %myFolderPath%
Generally, it makes sense to use built-in commands or functions if available, before incorporating ActiveX, COM objects or DLL calls; those should provide extra functionality, and not replace what AHK can do out of the box. That, of course, occasionally requires some digging into the docs, but it's worth it! AHK is one of the most well-documented automation scripting languages for Windows.