How can I make my Voice Assistant launch the apps? - python-3.8

I am working on a Voice Assistant.
I need to allow it to launch apps, how can be found the path of the apps to launch them?

Your question is quite minimal but I can attempt to answer it for you.
Assuming that you're using windows 10, with Word for example, you would type in word using the indexing feature at the bottom left of your desktop. Then you would click the down arrow to reveal more options. Then you would click open file location. The address at the top of your explorer will show the file location.
If you want to open another exe (or compatible software) in a known location but is not available to index, you would open your explorer and navigate to the desired application. Copy paste the address at the top of the explorer window.

You should import subprocess to your code and when you need to open the app write subprocess.check_output("file location", shell=True)
For example:
subprocess.check_output("C:\\Test\\Test\\Test\\application.exe(or .lnk or something u need)", shell=True)

Related

Does anyone know how do i get the list of all the applications installed in phone that can run audio files in react-native?

I want to create a functionality in react-native app such that on pressing a particular button, it should get me to the "open with" window, and that window should fetch me the list of all the installed applications in the phone which can run audio files. How can i get such list?
On a Android system, that "Open with" screen pops up when:
The user have more than one application that can play that specific audio format(Because it's not every app that can run every audio format).
The user did not set-up a default app to open the audio format.
So, You should just use a library like rn-fetch-blob to open the file for you, like as follow:
RNFetchBlob.android.actionViewIntent(fileLocation, mimeType)
And android will take care of picking the right app for you.
In case this answer does not satisfy you, you can get a list of apps using react-native-android-installed-apps-unblocking, but there's no information about wich ones can run an audio file, and maybe IOS will have some restrictions about what can be done, so your best option is to let the system do that for you!

Using selenium drivers to Print to PDF

I am struggling with a problem.
I need to download PDF file when the Print dialog appears.
Here is an example of the dialog
I have tried both the chrome and firefox drivers. But unfortunately still cannot get it working.
I have found the following preference for the firefox
fp.setPreference("print.print_to_file", true);
But it seems that it doesn't work.
It doesn't even get applied into the configuration variables set.
Please suggest any way to automate some actions with selenium and then save to PDF file when this print dialog appears.
Firstly, you need to know selenium is a web automation tool. so it can only operate things belongs to browser. Even that, it can't operate all things belongs to browser, like address bar, favior bar, menu bar of browser.
For most case, the print dialog is not belongs to browser, it supplyed by OS or other software installed on OS. so selenium can't operate it is reasonable.
If your script code by java, you can use java.awt.robot to capture the dialog
and click 'print to file'.
If java.awt.robot can worked as your expect, I think you aslo need to set browser options in your script to give a path for browser to save the printed file, just like when you download file, browse will ask you where to save.
if you not to set that options, i guess it will pop-up another dialog to ask you where to save and this dialog is also not belongs to browser.
it's not easy to use java.awt.robot to set the save path.
Because you need to consider the possbility of script run on different OS, use abosulte path is not workable on different OS. Besides if your script run with seleniu grid, it will make you craze. So if testing print to file feature is not important, i recommend you test it manuall.
You can automate Print to PDF using Testmate as below
http://thetestmate.com/save-as-pdf-in-chrome-testmate-selenium/

VB.net or Windows API: How to find out which icons the file explorer uses?

I am currently working on a Windows desktop application using VB.net where I would like to have a file and folder browsing interface directly integrated, i.e. the user does not have to open a file browser dialog to select files.
My file browser should resemble the original Windows file explorer at least in that it uses the same icons for the most common locations. For example, I would like to include the "Favorites" folder with the appropriate icon (please note that this is NOT the IE favorites folder, but the folder which comes up when you type shell:links into the address bar of the file explorer).
My problem is fetching the icon. So far, I have written a wrapper class for some functions of the Windows API, notably SHGetKnownFolderPath and SHGetFileInfo. My approach is the following:
1) Use SHGetKnownFolderPath to get the full path to the respective location (which depends on the Windows version and localization). This part works like expected. For example, on my system (W7 Pro x64), SHGetKnownFolderPath returns "C:\Users\Administrator\Links" when queried with the respective rfid.
2) Use SHGetFileInfo to fetch the icon which Windows considers the default icon for the path obtained in 1). This part technically works as well, but the wrong icon is returned - wrong in the sense that it is another icon than Windows file explorer uses for the same location.
I have tried that with four different locations (MyLibraries, MyFavorites (Links), MyComputer, MyNetwork). The icon for MyLibraries was the expected one, the other three were completely different from the icons Windows file explorer uses.
So I have got some questions:
1) Is there any way to detect which icons are used by the standard Windows file explorer for certain folders, e.g. "Favorites" (C:\Users\Administrator\Links on my machine)? I would be interested in a general solution (i.e. a solution which works for all locations described here).
2) If there is no such way, I will find out the number (index) of all icons of interest in shell32.dll (actually, there are only a few at the moment). Can I be sure that those indexes won't change in the future?
3) According to this document, I have to call CoInitialize before using SHGetFileInfo. I believe that the .NET framework automatically does this for the main thread before starting it and thus have not done it on my own yet (the development of the application has just started, and there is only one thread at the moment).
I think that the missing call to CoInitialize can't be the cause for the "wrong" icons. If I'm wrong here, please let me know.
A potential solution could be using a .NET language or the native Windows API / SDK. As long as there is some way (even an extremely complicated one) to use the solution from within VB.net, I will be happy with it.
Explorer uses 2 ways to detect icon of any object, file or folder.
1) call IShellFolder.GetUIObjectOf(IExtractIconA/W) and work with IExtractIcon.
2) query IShellFolder.QueryInterface(IShellIcon) and call IShellIcon.GetIconOf.
You can do the same.

My goal is to launch a file using vb.net via the click of a button

My goal is to launch a file using this in vb.net via the click of a button..
System.Diagnostics.Process.Start("X:\Desktop\Brutal Doom\PLAY ME BRUTAL DOOM!!!.pk3")
Which works, however as soon as I move to my laptop or another computer the button can no longer find the file as the drive letter has changed.. is there a way to code this so that it is no longer dependable on the drive letter and only will see \Brutal Doom\PLAM ME BRUTAL DOOM!!!.pk3 thus working on whatever computer I put the folder on...
Are you basically looking for this? How to get a path to the desktop for current user in C#?
ie System.Diagnostics.Process.Start(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Brutal Doom\PLAY ME BRUTAL DOOM!!!.pk3")

Add more one button on Attach menu of Whatsapp

I've an idea to develop a modification to WhatsApp, for example now when I click attachment symbol it shows only 6 I want to add one more option to it. If it's possible let me know. I want to add more one button on Attach menu.
It is not clear what exactly you are asking.
You have an option to launch other applications from your app.
If you want to change the way a certain app looks, or behaves you have to write something similar to it for people to use, but you cannot change the original app (no one will let you)
Here you go! it's possible, as #Jef said in comments.
using documentation interaction controller.
https://www.whatsapp.com/faq/iphone/23559013
you need to work on how to hook into attachment menu.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDocumentInteractionController_class/
There is an assumption in your question that these other apps are put there by the whatsApp developers, or by a third party who was somehow able to modify their code. I suspect that what is happening is that they (whatsApp) simply export a document/file of a certain type (UTI) If your application supports that same UTI it should appear here. So there is six buttons for you, on your phone, but another user might see a different number, it depends entirely what they have installed on their device.
CONCEPTUAL.. if you double click on a file on your computer then the file browser (OS) opens that file with some application or other. Perhaps it is a .doc file and the OS pushes that file to word or pages. Or it may be a .psd file and it gets pushed to photoshop. How does this happen? The OS has a registry (database) of applications for each file type, applications sign up on this when they install/update. If you right click on a file you see an 'open in..' option that lists all your applications which can handle that file type, this is the menu that you are wanting to get onto (for whatsApp's file type) imho.
So you need to
1 ascertain what file type (UTI) WhatsApp is exporting
2 declare support for that file type in your application (this is the bit which will be platform specific solution) (iOS docs https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1 )
**edit/addition
3. add the code to actually handle the file when your app receives it. On iOs this is in the appDelegate in
-(void) application: openURL: sourceApplication:annotation:
If the Whatsapp people have published an API then thats where you want to look. Good luck