这个问题的简单版本是这个。
if outlook.application "is available" then
'run the command for sending an email
else
'open/display the current users document folder
end if
'do some stuff...
我的电子邮件功能本身就很好用,但是我似乎无法弄清楚如何测试Outlook并绕过显示文件夹...
答案 0 :(得分:2)
以下代码首先检查Outlook是否已在运行。如果是这样,则将应用程序分配给olApp。如果没有,它将启动应用程序(如果有),并将其分配给olApp。
#!usr/bin/env python3
from bs4 import BeautifulSoup
import urllib.request
class Opener(urllib.request.FancyURLopener):
version = "Mozilla/5.0"
opener = Opener()
test = '<a id="dlbutton" href="https://www55.zippyshare.com/d/H7prSkjz/2176/Barrier%20Line%20Riddim%20-%20%20J.%20Small%20Records.zip"><div class="download"></div></a>'
dstar = 'https://www55.zippyshare.com/v/H7prSkjz/file.html'
def grabzip(url):
link = BeautifulSoup(opener.open(url), "html.parser")
for ziplink in link.find_all('a', id="dlbutton"):
print(ziplink.get('href'))
grabzip(dstar)