Bettylou

Automatically double click an exe file

4 posts in this topic

I know I'm going to kick myself for asking this but I can't find the answer anywhere.

I have a compiled exe program that creates a notepad file on the desktop. But clients are complaining about having to double click the file to open it. They want it to automatically pop up open on the desktop. How do I automatically double click it?

The file open command is -

$colItems = ""
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\localhost\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 0x30)
If IsObj($colItems) then
$File = FileOpen("MonthlyLog.txt", 2 + 8 + 128)
For $objItem In $colItems
FileWrite($File, "Running from:" & @ScriptDir & " " & "(" & @HOUR & ":" & @MIN & ":" & @SEC & " - " & @MON & "/" & @MDAY & "/" & @YEAR & ")" & @CRLF)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

ShellExecute(@DesktopDir & "\MonthlyLog.txt")

This would need to be added to your program.

Edited by 1957classic

Share this post


Link to post
Share on other sites

Thanks. I'm doing more than kicking myself. there's quite a few swear words floating around here. I am so cheesed off at myself for being so stupid.  I would have read that particular help file a dozen times.

I added it to the end of the program and hey it works like a dream.

EndFunc
ShellExecute(@DesktopDir & "\MonthlyLog.txt")
FileClose($File)

 

 

Share this post


Link to post
Share on other sites

We've all been there and done that. Glad to help.

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now