Post build event command whose directory is not C:\ - post-build-event

I want to run a command in the post build event of a project, if i do C:\temp\Client.exe it works fine but If my project is in the thumb drive and change the command to G:\temp\Client.exe it looks like it doesnt like the path and exit with code 9009. what command do i need if the exe is in different path than C drive. Thankx

From the question and subsequent comment it looks that drive letter keeps changing. It is possible in post-build section check if the file exist before call it.
For debugging you can use something like
f:
Dir
And view output window after the build.

Related

Dynamic User in .bat file

This is my first time trying to use .bat files. I am trying to make one that keeps my front end of my Access database on the most current version for users (only ~7).
I am using:
md C:\Users\tmyers\Desktop
del C:\Users\tmyers\Desktop\Quotations.accdr
copy "\Users\counter1152\desktop\PM DESKTOP FILES\Lighting Project Management Application\Quotations.accdr" C:\Users\tmyers\Desktop
C:\Users\tmyers\Desktop\Quotations.accdr
Part of the copy string I removed due to being the path to our server (just in case). I need the user to somehow be dynamic based on the person executing the file. I could make a special .bat file for each person since I dont have many users, but that seems sloppy.
As a secondary question, how can I get the cmd prompt window to not show when this is executed? That would just be a personal preference of mine. I did find https://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window for reference but am not 100% sure how to do wscript.
try with :
md "%userprofile%\Desktop"
del "%userprofile%\Desktop\Quotations.accdr"
copy "\Users\counter1152\desktop\PM DESKTOP FILES\Lighting Project Management Application\Quotations.accdr" "%userprofile%\Desktop"
"%userprofile%\Desktop\Quotations.accdr"
To auto-hide the cmd.exe window you can use windowmode.bat and getCMDPid.bat:
call getcmdbit.bat
call windowmode.bat -pid %errorlevel% -mode hidden

Keyboard short for uploading two files in PhpStorm

The problem
In PhpStorm I have a style.css- and a app.js-file that I have to upload to a server over and over again. I'm trying to automate it.
They're compiled by Webpack, so they are generated/compiled. Which means that I can't simply use the 'Tools' >> 'Deployment' >> 'Upload to...' (since that file isn't and won't every be open).
What I currently do
At the moment, every time I want to see the changed I've done, then I do this (for each file):
Navigate to the files in the file-tree (using the mouse)
Select it
The I've set up a shortcut for Main menu >> Tools >> Deployment >> Upload to..., where-after I select the server I want to upload to.
I do this approximately 100+ times per day.
The ideal solution
The ideal solution would be, that if I pressed a shortcut like CMD + Option + Shift + G
That it then uploaded a selection of files (a scope?) to a predefined remote server.
Solution attempts
Open and upload.
Changing to those files (using CMD + p) and then uploading them (once they're open). But the files are generated, which means that it takes PhpStorm a couple of seconds to render the content (which is necessary before I can do anything with the file) - so that's not faster.
Macro.
Recording a macro, uploading the two files, looking like this:
If I go to the menu and trigger the Macro, then it works. So far so good.
But if I assign a shortcut key and trigger that shortcut while in a file, then it shows me this:
And if I press '1' (for it to upload to number 1 on the list), then it uploads the file that I'm currently in(!?), and not the two files from my macro.
I've tried several different shortcuts (to rule out some kind of keyboard-shortcut-clash):
CMD + Option + CTRL + 0
CMD + Shift 0
CMD + ;
... Same result.
And the PhpStorm Macro's doesn't seem to give me that many options anyways.
Keyboard Maestro.
I've tried doing it using Keyboard Maestro.
But I can't get it setup right. Because if it can't find the folders (if they're off-screen or if I'm in a different project and forgot to adjust they shortcuts), then it blasts through the rest of the recorded actions, resulting in chaos. Ideally it should stop, if it can't find the file on the screen.
Update1 - External program
Even if it's not possible to do in PhpStorm, - are there then another program that I could achieve this with?
Update2 - Automatic Deployment in PhpStorm
I've previously used this, - but I've had happen a few times that I started sync'ing waaaay to many files, overwriting critical core files. It seems smart, but can possibly tear down walls if I've forgotten to define an ignore properly.
I wish there was an 'Automatic Deployment for theses files'-function.
Update3 - File Watchers
I looked into file-watchers ( recommendation from #LazyOne ). Based on this forum thread, then file watchers cannot be used to upload files.
It is possible to accomplish it using external program scp (Secure Copy Protocol):
Steps:
1. Create a Scope (for compiled files app.js and style.css)
2. Create a Custom File Watcher with scp over that Scope
Start with Scope:
Create a Local Scope with name scp files for your compiled files directory (I will assume that your webpack compiles into dist directory):
Then, to add dist directory into Scope, select that folder and click on Include Recursively. Apply and Move to File Watchers
Create a custom template for File Watcher:
Choose a Name
Choose File type as Any
Choose Scope as scp files(created earlier)
Choose Program as scp
Choose Arguments as $FileName$ REMOTE_USER#REMOTE_HOST:/REMOTE_DIR_PATH/$FileName$
Choose Working directory as $FileDir$
That's it, basically what we have done is every time when a file in that scope changes, that file is copied with scp to the remote server to the corresponding path.
Voila. Apply Everything and recompile your project and you will see that everything is uploaded to the server.
(I assumed that you have already set up your ssh client; Generated public/private keys; Added a public key in your remote server; And, know ssh credentials to connect to your remote server)
I figured this out myself. I posted the answer here.
The two questions are kind of similar but not identical.
This way I found is also not the best, since it stores the server password in clean text. So I'll leave the question open, in case someone can come up with a better way to achieve this.

browserstack+nightwatch custom commands configuration

I have a Nightwatch + BrowserStack configuration on my project and I'm trying to add custom commands to my project to compare 2 screenshots using resemble.js .
I configure my nightwatch.json file with this :
"custom_commands_path": "./node_modules/nightwatch/commands",
"custom_assertions_path": "./node_modules/nightwatch/assertions"
I put the commands file in the folder and I tried to run my test in every directory possible to see if it was a path problem. I've also tried with different commands, some of them I get online and even the default example one. Whatever I run it returns nameOfTheCommand is not a function. So I guess it does not even find the path to the customs commands in the nightwatch.json file.
Is there anything I'm missing here? I'm quite new so the answer could be very simple but I tried every .json file of my project in case there was a special configuration linked to BrowserStack.
Path to the custom commands should be analogous to the path to custom commands. You should point a folder where you added them.
I've found that if I put them in the suite configuration file, it picks them up:
nightwatch_config = {
src_folders: ["tests/suite/product/"],
page_objects_path: "pages/product",
custom_commands_path: "./custom_commands"
}

tk_getSaveFile Will not open dialogue in specified directory? (Tcl/Tk)

I must preface this question with the following information:
This problem only occurs when my application is wrapped with TclApp
I understand that when wrapping a Tcl program, one must lappend to the auto_path the location of the directory the program needs to look for files if it is not already wrapped in the internal file system. That is what I have done, but my code only works for tk_getOpenFile, not tk_getSaveFile. Rather than opening the save dialogue in the specified directory, it opens it in My Documents.
Here is essentially what I'm doing:
set root [file dirname [info script]];
if {$iswrapped} {
lappend auto_path "$root/../../../../myFolder";
set target_dir "$root/../../../../myFolder";
}
set filename [tk_getSaveFile -initialdir $target_dir -title "Save As"];
I've made sure this isn't an issue with Windows (where it saves the dialogue open location after saving/opening the first time there with the program.) When I run my program for the first time on a brand new system, tk_getSaveFile opens in My Documents, whereas tk_getOpenFile opens in the correct folder, 'myFolder.'
Any ideas?
Edit:
I now noticed a very strange issue occuring as well and I suspect it might be related. Now, whenever I save a file in any child directory under C:\, I can only see the file through my program's open and save dialogues. If I navigate to the same location in the Windows Explorer, there files are not only not visible, but not there at all! What is going on here?
Edit:
My program had to be run with administrator privileges - that's why I got that really strange error (the second one.)

WIX: Using a temporary file during install

I am writing a WIX installer and I have a following requirement:
During installation, I need to pass an absolute path to a file (lets call it A) included in my installer to a COM component, which already exists on the hard drive and is a part of another program. I have already written an appropriate Custom Action which expects a path to the file A. I don't want to include A as a file installed in the Program Files folder and removed during the uninstallation process. Instead, I would like to put A only temporary on the hard drive, call my Custom Action which will cause the COM component to use the content of A, and then remove A from disk. Is there an easy way to accomplish this goal?
I have tried to utilize the Binary Table and store A there, however I don't know how to reference A using absolute path. I know I could put A outside of MSI file but I would like to keep every file installer needs in a single MSI.
Any help would be appreciated.
Deleting a file that MSI installed means that MSI will consider it "broken" and try to auto-repair it if called on to do so. That happens automatically in several cases (e.g., advertised shortcuts and COM registration) so I'd recommend against it. Leave the file there instead -- it's done its job and there's no harm in leaving it there.
I would take this approach.
Install the file "A" into any directory. Run your custom action needed to update the COM component. Then run another custom action or modify the currently written one to remove the file after it is no longer in use. This would leave no trace of the file "A" and if you schedule the custom action to only run during the install you won't have to worry about it on uninstall.