Get latest Office 2013 Customization Tool, command line

Office 2013 Customization Tool releases a new version every two months or something.
Old links do not work anymore and also if you have bookmarked the main link for official Office 2013 Customization Tool download page then it has been removed too! every time we have to search again for Office 2013 Customization Tool and look for new links :@

Lets create some automation process ;)

1. Use search link to look for product.
I will use keywords "Office 2013 Administrative Template files":
https://www.microsoft.com/en-us/search/Results.aspx?q=Office%202013%20Administrative%20Template%20files
2. Take first search result and replace details with confirmation.
This will move to the instant downlod page. For example:
before: http://www.microsoft.com/en-us/download/details.aspx?id=35554
 after: http://www.microsoft.com/en-us/download/confirmation.aspx?id=35554
3. Look for full http links wich begins with http and ends with exe:
sed "s/\d034/\n/g" | grep "^http.*exe" | gnusort | uniq
Here is project files for windows:
https://github.com/catonrug/get-office-2013-cust-tool-windows-cmd/archive/master.zip

In linux environment:
#!/bin/sh
if [ ! -e "o15cust.db" ]
then
touch o15cust.db
fi

rm -rf admintemplates*
linklist=$(wget --no-cookies --no-check-certificate -qO- "https://www.microsoft.com/en-us/search/Results.aspx?q=Office%202013%20Administrative%20Template%20files" --user-agent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)" | sed "s/\d034/\n/g" | grep "^http.*en-us.*download.*details" | sort | uniq | sed "s/details/confirmation/")
filelist=$(wget --no-cookies --no-check-certificate -qO- "$linklist" --user-agent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)" | sed "s/\d034/\n/g" | grep "^http.*exe" | sort | uniq | sed '$aend of file')
printf %s "$filelist" | while IFS= read -r url
do {
echo $url
cat o15cust.db | grep "$url"
if [ $? -ne 0 ]
then
filename=$(echo $url | sed "s/^.*\///g")
echo $filename
wget --no-cookies --no-check-certificate $url -O $filename
o15cust_md5=$(md5sum $filename | sed "s/\s.*//g")
echo $o15cust_md5
o15cust_sha1=$(sha1sum $filename | sed "s/\s.*//g")
echo $o15cust_sha1
echo "$url">>o15cust.db
echo "$o15cust_md5">>o15cust.db
echo "$o15cust_sha1">>o15cust.db
fi
} done

No comments: