Jump to content

How to cancel, pls?


Recommended Posts

$DLLorOCXpath = InputBox("Path to DLL or OCX ...", "Enter the path to the DLL or OCX you need to register.", "", "", 350, 125)     ; width, height, left, top
ClipPut(@SystemDir & "\regsvr32.exe" & " """ & $DLLorOCXpath & """")

MsgBox(64," DLL - OCX registration ..."," The information has been sent to the clipboard." & @CRLF & @CRLF & " (Retrieve this info by pressing ^V when you need to paste into the RUN box.)               ")

Exit     ; finished
I've started working with variables. I think I'm finally wrapping my brain around them somewhat.

The above script works fine. I need something for registering DLLs since I rarely need the syntax yet never remember what it is and it's a pain in the neck to hunt it down in my tips folders all the time. Whereas, I'm constantly in my AutoIt scripts folder, so this is a real timesaver for me.

Everything works fine to my amazement, except for the cancel button. I still haven't gotten a handle on getting buttons to work always. I've put different codes in different spots with varying results, but have yet to successfully get pressing the CANCEL button to close the AI box down.

Can someone help me out pls? Once I have one working example, I'll take it from there ... Naturally went through the archives, but no go on this particular type of syntax.

Thanks. :)

Link to comment
Share on other sites

I assume you mean to cancel the input. It will set a return value and in the case of an input an error msg. You can just trap for the error.

$DLLorOCXpath = InputBox("Path to DLL or OCX ...", "Enter the path to the DLL or OCX you need to register.", "", "", 350, 125)     ; width, height, left, top
If @error then Exit
ClipPut(@SystemDir & "\regsvr32.exe" & " """ & $DLLorOCXpath & """")

MsgBox(64," DLL - OCX registration ..."," The information has been sent to the clipboard." & @CRLF & @CRLF & " (Retrieve this info by pressing ^V when you need to paste into the RUN box.)               ")

Exit     ; finished
Link to comment
Share on other sites

Also, keep in mind, you do not even need to send it to the clipboard for the user to paste into the run box. You could simply do this instead:

$DLLorOCXpath = InputBox("Path to DLL or OCX ...", "Enter the path to the DLL or OCX you need to register.", "", "", 350, 125)     ; width, height, left, top
If @error Then Exit

Run(@SystemDir & '\regsvr32.exe /s "' & $DLLorOCXpath & '"'); the /s makes the operation silent.  Regsver32 will not say the dll was registered, even though it was.

Exit     ; finished

- The Kandie Man ;-)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

I assume you mean to cancel the input. It will set a return value and in the case of an input an error msg. You can just trap for the error.

$DLLorOCXpath = InputBox("Path to DLL or OCX ...", "Enter the path to the DLL or OCX you need to register.", "", "", 350, 125)     ; width, height, left, top
If @error then Exit
ClipPut(@SystemDir & "\regsvr32.exe" & " """ & $DLLorOCXpath & """")

MsgBox(64," DLL - OCX registration ..."," The information has been sent to the clipboard." & @CRLF & @CRLF & " (Retrieve this info by pressing ^V when you need to paste into the RUN box.)               ")

Exit     ; finished
Well, wadaya know! That is so way kewl. I will definitely be using that one whenever I can.

If @error then Exit

Is this "legal"? Is this an okay thing to use for the CANCEL button? Seems way too easy <g>. :)

Link to comment
Share on other sites

Also, keep in mind, you do not even need to send it to the clipboard for the user to paste into the run box. You could simply do this instead:

$DLLorOCXpath = InputBox("Path to DLL or OCX ...", "Enter the path to the DLL or OCX you need to register.", "", "", 350, 125)     ; width, height, left, top
If @error Then Exit

Run(@SystemDir & '\regsvr32.exe /s "' & $DLLorOCXpath & '"'); the /s makes the operation silent.  Regsver32 will not say the dll was registered, even though it was.

Exit     ; finished

- The Kandie Man ;-)

Thanks, this is really good to have, too. Registering DLLs is definitely something that I'll usu. want to handle manually after getting the info from this script, all the way down the line, but I can see having another for when I can do it silently, will be good. Both options are covered this way.

Thanks! :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...