vba.shell or SendKeys play youtube - vba

I have the following command:
VBA.Shell "C:\Program Files\Mozilla Firefox\firefox.exe -url https://www.youtube.com/watch?v=dQw4w9WgXcQ" to open a rickroll video on youtube but cant manage to get it to play. Is there an argument I can send into the first string to play? or is there another way to send input with VBA
I have tried the SendKeys("k") method to no avail and get an error and I've tried looking up documentation but I wasnt able to find much.

Related

Youtube dl Unable to extract video data 't' is not recognized as an internal or external command, operable program or batch file

Hello so I would like to begin with that I am not extremely tech savvy. I am trying to download a video so that I can reformat it. I keep on receiving and error that says "unable to extract video data 't' is not recognized as an internal or external command. I tried to update youtube-dl, but it said it couldn't find an new version. I'm not sure if the issue I am having is that I can't update youtube-dl or if there is an issue with me downloading the video itself.
Here is the script line that I used to download the video.
C:\Users\name> YouTube-dl.exe -f bestvideo+bestaudio https://www.youtube.com/watch?v=llRfY17n-Lo&t=321s
[youtube] llRfY17n-Lo: Downloading webpage
ERROR: llRfY17n-Lo: YouTube said: Unable to extract video data
't' is not recognized as an internal or external command,
operable program or batch file.
Here is the scripts I used to try and update Youtube dl.
C:\Users\name>youtube-dl.exe -U
ERROR: can't find the current version. Please try again later.
C:\Users\name>youtube-dl -U
ERROR: can't find the current version. Please try again later.
I had similar problems with the following errors:
'v' is not recognized as an internal or external command,
operable program or batch file.
and
'feature' is not recognized as an internal or external command,
operable program or batch file.
I fixed the error and was able to download the file by entering the following command in command line and pressing enter:
youtube-dl **video identifier**
where video identifier is the series of digits that comes after "v=".
For example, if your video URL is https://www.youtube.com/watch?v=dMH0bHeiRNg --> the identifier is dMH0bHeiRNg and the whole command is:
youtube-dl dMH0bHeiRNg
Actually I have found another solution to this:
in Windows, open the folder that you want to download the video in, say it is C:\Users\username
Then press CTRL+L and write cmd and press enter. Now the command line opens at the desired folder. (Make sure the folder is not under Windows or system32.)
Write youtube-dl youtube.com/your_url and press enter and it should download the video just fine.

Can I have a custom URI protocol open the "default PDF viewer" on a user's machine to a specific remote file from a browser?

I would like to hypothetically have the URL annotate://\REMOTESERVER1\path\to\remote\file.pdf open the default PDF reader on a Windows user's machine with the remote file opened rather than downloading and opening it locally. I know the following works from the command line:
start \\REMOTESERVER1\path\to\remote\file.pdf
I've added keys to the registry using these instructions:
https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85)?redirectedfrom=MSDN
I've tried the following in the "command" value:
Register it to "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" with no variables - successfully launches Acrobat
Register it to "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" with the full path to the document hardcoded - successfully launches the document in Acrobat
Register it to "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" "%1" (both with and without quotes) - fails. Acrobat says the syntax to the path is invalid. I have tried various URI encoding schemes and escapes in the slashes but maybe I'm missing something?
Register different combinations of "start" (with/without quotes) and the full file path - fails; doesn't even try to open Acrobat.
Note:
These will all be Windows users
These users will all be on a VPN able to access this remote file
These users will all be using Adobe Acrobat however they may be using different versions, hence wanting to load the "default PDF viewer"
It doesn't look like Acrobat has anything built in to capture a custom URI protocol. Is there a solution for this?
Old thread, but needs an answer still.
Application protocol URIs pass the whole URI as the argument, not just the part you expect to be a parameter. So when you form a link acrobat:my.pdf, what comes into the HKEY_CLASSES_ROOT\acrobat\shell\open\command as %1 isn't my.pdf, but acrobat:my.pdf.
Replacing Computer\HKEY_CLASSES_ROOT\acrobat\shell\open\command\Default="C:\program files\adobe\acrobat DC\acrobat\acrobat.exe" "%1"
with
Default=cmd /v:on /c "SET _invocation=%1 & "C:\program files\adobe\acrobat DC\acrobat\acrobat.exe" !_invocation:acrobat:=!"
Is a way to get around it.
Edit: couple notes on this.
This does work with SharePoint to properly checkout files, making "save" work rather than forced to do "save as".
The above does not play well with other Acrobat windows/tabs that are already open. To resolve this, delete Computer\HKEY_CLASSES_ROOT\acrobat\shell\open\ddeexec or delete the value of that key and sub keys.
That raises another issue of updates always restoring the ddeexec key. Though the command key persists updates, it is reset if "set adobe as default" is used.
So to resolve all this, just make a new protocol "adobe":
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\adobe]
#="URL:PDF Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\adobe\DefaultIcon]
#="C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Acrobat.exe"
[HKEY_CLASSES_ROOT\adobe\shell]
#="Open"
[HKEY_CLASSES_ROOT\adobe\shell\open]
#="Open with Adobe Acrobat"
[HKEY_CLASSES_ROOT\adobe\shell\open\command]
#="cmd /v:on /c \"SET _invocation=%1 & start \"\" \"C:\\program files\\adobe\\acrobat DC\\acrobat\\acrobat.exe\" !_invocation:adobe:=!\""

automate image upload from windows explore with selenium and AutoIT

I have to automate a scenario like a upload an image from windows explorer to TinyMCE component using Selenium. Since Selenium does not support OS control, I used AutoIt to upload the image.
AutiIt sets the image path to "File name" and seems like it clicks on 'Open' button as well. But the image is not loading to my "source" field.
Here is my Selenium command:
Runtime.getRuntime().exec("C:/XXXXX/src/test/resources/uploadImage.exe");
// Path of the AutoIT script file
AutoIT script:
WinActivate("Open")
Send("C:\LCNGProjects\Screenshots\Images\GifImage1.gif")
Sleep(5000)
Send("{ENTER}")
Refer the attached screenshot
Not sure if I have got the questions correct, Did you compile the script.
Can you please go through link below for script compilation and step by step info how to upload a file.
https://www.guru99.com/use-autoit-selenium.html
You do not need to use AutoIt. Auto will make your script dependable on windows machine only.
Instead of it find element using locator(i.e. xpath) of upload button which is having tag as type="file". Now pass this simple sendKeys with absolute path of your image in your machine like below:-
button2.sendKeys("C:\\UsersDesktop\\logo\\Summit-Logo-900px.png");
Or use
System.getProperty("user.dir"));
Append the path of file exluding your project path and filename inside your project
Example :-
button.sendKeys(System.getProperty("user.dir")+"\\logo\\Summit-Logo-900px.png");
below link contains more option to upload file like below :-
Using SendKeys command.
Using AutoIt scripting.
Using Jacob com interface.
http://www.techbeamers.com/handle-file-upload-selenium-webdriver/#h3
Hope it will help you :)
I'm not going to add full source code here. You can call the AutoIT script using this command inside your test case.
// Call to AutoIT script to upload the image
Runtime.getRuntime().exec("C:\\xxxxx\\src\\test\\resources\\uploadImage.exe");
AutoIT Scrip
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\xxxx\Images\jpgImage")
ControlClick("Open","","Button1")
For more information refer the following link
https://www.guru99.com/use-autoit-selenium.html

How to run msg.exe after opening a shell using cmd.exe

I want to send messages withing a windows 7 LAN using VB.NET code. The problem is that the msg.exe executes commands in admin mode only. Here is the code.
Shell("cmd.exe /k runas /user:farook-pc\administrator msg.exe") 'Here i'm prompted for a password.
Shell("cmd.exe /k msg.exe", 1)
I use the /k switch to see what's going on in the shell. /c is the silent switch. I do not wish to use runas neither do I wish to change privilages in msg.exe
I hate launching other apps and trying to control them like that. If possible, I would recommend trying to mimic the functionality of msg.exe, yourself, programatically. From doing a few quick google searches, I found that the API function that msg.exe uses is apparently WTSSendMessage in Wtsapi32.dll. Here's the MSDN article on that function:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383842(v=vs.85).aspx
And here's a link that shows how to invoke that API function from .NET:
http://www.pinvoke.net/default.aspx/wtsapi32/wtssendmessage.html
I've never used it before, or even heard of it before, so, unfortunately, I can't help you beyond that.
Its possible to start the VB.NET application automatically in admin mode.
That can be changed in the project-settings.
After that you can open msg.exe with the following command:
Shell("msg.exe")

Application Loader: "Cannot proceed with delivery: an existing transporter instance is currently uploading this package"

I have been unable to overcome this error in Application Loader. I've quit, restarted, tried different computers - it's like the server is hung up on an op that I never initiated and it won't time out. Has anyone seen it before and beaten it?
Basically, you need to clear out the transport tokens. This can happen if you were to close out of Xcode while in the middle of submitting an app to iTunes Connect.
The token files now appear in the
Library/Caches/com.apple.amp.itmstransporter/UploadTokens/ subfolder of the given user's home directory. Which, honestly, is a better place for them anyway.
Delete any .token files in this directory.
--
If you are unable to find the .token files, this is because they are hidden in Finder. To hide/show hidden files in Finder, use the following Terminal command (TRUE = UNHIDE, FALSE = HIDE):
defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder
You need to clear out the transport tokens.
Open Terminal on your Mac, and paste:
rm /Users/<username>/Library/Caches/com.apple.amp.itmstransporter/UploadTokens/*.token
That should clear the stuck token. After this, try uploading the build again.
It might be because Xcode crashed as you were uploading your app. Either, all you need to do is delete the token files:
Open Terminal on your Mac, and paste:
rm ~/.itmstransporter/UploadTokens/*.token
That should clear it. If it still doesn't work (at this point you should try re-uploading your app), run that command on Terminal again, or manually go to...
/Users/<username>/.itmstransporter/UploadTokens/
...and delete all the .token files.
Hope that helps!
token was in here
/Users/(user_name)/Library/Caches/com.apple.amp.itmstransporter/UploadTokens/
Appreciated #WrightsCS 's answer It helps me to overcome Application Loader issue.
I would like to highlight one more thing here.
I proceed as per #WrightsCS answer and it resolved Application loader error:
Can not proceed with delivery: an existing transporter instance is currently uploading this package
But I found one more issue after removing all tokens from
/Users//.itmstransporter/UploadTokens/
I went to iTunesConnect and clicked on "My Apps", what I saw a message that "Can not connect... please contact Apple".
Here I don't know why it suddenly stops working!
I submitted the same build which was there on iTunesConnect for submission but it has shown as processing.
After submission of that build, iTunesConnect works fine! Also, I am able to see last uploaded build in a list for submission.
In my case (I am using OSX Catalina), I was not able to find the folder:
Library/Caches/com.apple.amp.itmstransporter/UploadTokens/
Under my user home directory (even when showing hidden files and folders)
but it seems my problem was a bit different and I just closed xCode completely (every xCode window opened) and reopened it again then I archived my project and uploaded it without any issues
maybe this could help someone else fix this issue
You need to clear out the upload tokens that are "stuck". To do this, open the tokens file found in /users//.itmstransporter/UploadTokens/. You should see one line of text at the top that refers to your current upload token. Simply delete this line and save the file. You should now be able to submit your app again.
Cheers