Findmerge graphical using paramiko - clearcase

I have a script on a remote clearcase server which I execute using paramiko invoke_shell.The script contains a cleartool findmerge command graphical but the graphical window never opens though I used x11 forwarding. It waits forever.I even added the checkout comments for the merge. I want the graphical window to be opened.

It depends how you did setup your X-forwarding: see this thread for example:
Launch Exceed
Launch Putty
In the putty configuration window, select Connection, then SSH, and then X11 from the left side menus.
On the right side, select the checkbox for Enable X11 forwarding and set the X display location to "localhost:0" .
In the putty configuration window, select Session from the left side.
Enter the hostname of a system to connect to Select the SSH protocol
Save settings by selecting the Save button on the right.
Invoke session by double-clicking on hostname
from the server, run "export DISPLAY=windows ip:0"
You should be able to run any X-based tool or application
e.g. clearprojexp &
The OP Srikar Veeramallu mentions in the comments:
I am in a dynamic view set using cleartool setview
That explains why it "waits forever". A setview will create a sub-shell, which might not benefit from the same X11 forwarding as the main shell.
See "Python and ClearCase setview" for more details.
The workaround is to use the full path of the view.

Related

How to make WebDriver operate browser in background?

I have a python script which uses Selenium WebDriver to start a Chrome, open an URL, enter simple captcha, check if some data available (time for visit government organization) and repeat this process in 5 minutes.
I want it work in background. Headless mode is not an option because site would show DDos Guard in that case.
I have tried to use driver.minimize_window() but the windows activates for short periods for number input and click of button which is annoying when I work on PC.
Is it possible to make it work completely in background without activate Chrome window?
You can packaging your script using PyInstaller, then run it with Windows Task Scheduler (assuming you are using Windows)
Install pyinstaller
pip install -U pyinstaller
2. Packaging your script (run in cmd)
pyinstaller --onefile --name=your-package-name yourscript.py
Check pyinstaller docs and make sure add --hidden-import or --collect-data flag if needed.
Setup your task scheduler:
Create basic task, choose task name, and description (if needed)
Create trigger
Set action to start a program then define your script name in Program/script and make sure put your script folder path in Start in
Then voila. You can custom the trigger more detail in task properties (creating multiple triggers, specific conditions, etc...)
You could try to start your exe file as process manually using cmd/powershell like this SO answer, and some kind of process/service manager but I have never tried it yet.
When I use selenium and headless option don't work with me, I always do this trick by changing the window size and just leave it.
So, set the window size in the driver itself, like this:
driver.set_window_size(1, 1)
Or, set it as an argument, like this:
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('window-size=1,1')
Or use both.
I hope this helps you.

Restart Applescript causing infinite reboot loop

I tried to set up Voice Control to restart my mac by running the applescript:
tell application "System Events"
restart
end tell
I set it up for voice control. I'd say "Restart the Mac"
However this put my mac into an infinite restart loop!
Had to trash the script.
Is there a solution to this problem with a different applescript that doesn't go into a loop? It would be great to simply say "Restart the Mac" and then presto it restarts.
I use Voice Control every day, without error, to restart my computer.
These are the steps I took.
Paste this following AppleScript code into a new Script Editor document and save it as "Restart Computer.scpt" (Don't save it to any "Startup Items" Folder)
tell application "System Events" to restart
Make sure you grant access in System Preferences for System Events.app to be allowed to control your computer.
With Voice Control currently active, select the new "Restart Computer.scpt" file in Finder, then speak the command "Make This Speakable".
You Should then see a pop-up window like this...
Just insert the voice command you want to use (I use "Restart Computer") and click Save.
Note: Before doing all of this, you should remove any previous custom commands you have set for restarting the computer, from your Commands list in System Preferences.
As an added bonus, this following AppleScript code will reveal the file which stores all of your custom voice commands, in Finder. It's a good idea to backup this file from time to time. Also copying this file to a different computer will allow you to use the custom commands on that computer.
set customDictationCommands to (path to preferences folder as text) & ¬
"com.apple.speech.recognition.AppleSpeechRecognition.CustomCommands.plist"
tell application "Finder" to reveal alias customDictationCommands
I don't think AppleScript is the best tool for this. In System Preferences→Accessibility→Voice Control you can enable Apple's built-in voice command system, which should work out-of-the-box. They don't have a built-in Restart command so you'll have to create one, but that's easy enough. Click the 'Commands...' button at the bottom right, then click the '+' button at the bottom left, and you can choose any of several ways of implementing it.
With restarting script saved as application the simple restart command will enter into infinite reboot loop. This is because of unsaved state of application.
To solve this problem, use following script application instead:
tell application "System Events" to restart with state saving preference

Can I keep vscode Terminal connected to host machine while in Docker environment using Remote Containers extension?

I have the Remote Containers extension setup so I can jump into a docker container for autocomplete etc. That's working how I want it to.
But it also sets the Terminal window to be inside that environment and I want to instead keep the Terminal window connected to my host machine. I can understand why it's useful to have Terminal from inside the container, but it's not useful for my usecase and it breaks some of my testing tools.
There are 2 commands in VS Code to open terminal windows when using Remote Containers extension:
Terminal: Create New Integrated Terminal will open a terminal window within a container.
Terminal: Create New Integrated Terminal (Local) will open a terminal on your host machine.
Latter doesn't seem to have have a key binding assigned, so you may want to add one.

Cmder/Conemu: dynamically name tab title from within task definition

I am using Putty in Cmder to ssh to a 'jumpbox'. I then pass a hostname in a file using the -m ssh option to jump to the 'real' destination host.
I want to dynamically set the title of the putty tab from within a task definition in Cmder/ConEmu to be the hostname I'm jumping to. In the screenshot below you can see that I have attempted to use "%REMOTE_HOST%" to pass in an environment variable containing the title that I want to have on my tab. However this just creates a tab named %REMOTE_HOST%.
Any help would be greatly appreciated.
I explained many times that PuTTY and mintty are not console applications, they are GUI applications with their own graphical interface.
An analogy: you run VirtualBox with Ubuntu (as client) in Windows (as host) and some console application in you VirtualBox-ed Ubuntu. Don't you wonder why TaskBar in Windows does not show the title of Ubuntu console?
When you run ChildGUI in ConEmu it shows in the Tab children window title.
What you need to do
Configure PuTTY or your remote host (e.g. bash prompt with ANSI) to show proper text in PuTTY title. The questsion has nothing to do with ConEmu.
Also, ensure that the tab bar console template in ConEmu/Cmder settings is or contains %s. e.g.

Execution of QTP scripts on remote machines

I am posting this question regarding the execution of QTP scripts on remote machine. When i log in to my remote machine via "mstsc", and execute the script without closing the remote desktop connection, it works fine. But once i close/minimize the remote desktop window, it starts throwing error ( like Object not visible" error.
One of the places where it generally throws error is while clicking on the file menu in IE, as shown below :-
Browser(" page name -").WinToolbar("ToolbarWindow32").Press "&File"
Are there any workarounds to resolve the same??
Most of the QTP scripts take lot of time to execute, and if the prerequisite is to keep the screen active without even locking, isnt it one of the key disadvantages?
Thanks in advance!!!
Steve
QTP replays some steps by manipulating the mouse and keyboard devices. When an RDP session is minimized windows knows that there is nobody at the controls and therefore doesn't respond to the mouse and keyboard events which causes QTP to fail.
A workaround to this is to connect to the machine via another application rather than mstsc (for example VNC) which doesn't communicate to windows that it has been minimized. Either that or leave the RDP window open.
If you want to run QuickTest in a minimized RDP session, and you are using an RDP >= 6.0 client, you can enable it by setting a registry value on the local computer:
Navigate to one of the following registry paths on the local computer:
Current User: HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
or
All Users: HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.
Note that this does not work when the computer is locked or logged off.
one more simple way
just maximize RDP session , then scripts will run don't minimize
you remove the lock of the machine.

Resources