Set File Association?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Set File Association?

Post by JRL » Wed Apr 01, 2015 3:53 pm

Does anyone know how to set file association programmatically without having to reboot the computer to get the association to the file extension working? If you set the registry values you then need to reboot the computer.

Back in the good old days when computers were still fun, all one needed to do was use the DOS assoc function. Today one can still use the assoc function but the file associated to the file type is no longer just the name of the file one wants to use. One needs to associate the OLE object for the file.

Having had six people in the last two days open infected zip file email attachments by double clicking them in Outlook, I want to create a one line Macro Scheduler message executable and associate that executable file to the .ZIP extension. I would like to do this programmatically so I don't have to visit 180 computers.

Anybody have any ideas?

How about an idea for what that one line in the Macro Scheduler message should say?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Set File Association?

Post by Marcus Tettmar » Thu Apr 02, 2015 3:09 pm

I didn't think a reboot was required. Should just have to set the correct HKEY_CLASSES_ROOT keys :-/ :?:
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Set File Association?

Post by JRL » Thu Apr 02, 2015 4:22 pm

Thanks for the response.

Looked it up again and though a "reboot" is not required, you do have to log out and back in to make the change so just about as bad.

Unless there is someone who has nothing better to do and really wants to figure this out, ignore this for now. I spoke yesterday with a gentleman from the spam filtering service we've had for the last xx years. He said they can filter these out but that I had chosen not to allow that when we first set this up. I don't recall so can't say I didn't. They currently filter executables and certain scripts (not Macro Scheduler). But by my choice they don't scan and filter ZIP files. That will change this week so hopefully the problem goes away.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Set File Association?

Post by Marcus Tettmar » Sat Apr 04, 2015 8:42 am

Try this:

Code: Select all

Let>HWND_BROADCAST=65535
Let>WM_SETTINGHANGE=26
Let>INI_INTL=1
LibFunc>user32,SendMessageA,result,HWND_BROADCAST,WM_SETTINGCHANGE,0,INI_INTL
Cribbed from:
http://stackoverflow.com/questions/1052 ... ng-c-sharp
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts