Jump to content

Help with buttons


 Share

Recommended Posts

I would like to be able to assign a certain function to a GUI button, notably "If FileExists". It would be used as a search / scan button which would begin the search criteria set forth in the script; a script I'm trying to port over from an earlier version which worked fine then...but now trying to assign these functions to buttons is getting to be a pain.

An example of a piece of the old script is:

If FileExists("c:\WINDOWS\system32\example.dll ") Then

WinActivate("Results.txt", "")

MsgBox(4096, "", "example.dll exists.")

ClipPut("c:\WINDOWS\system32\example.dll")

Send("c:\WINDOWS\system32\example.dll found" )

Send("{ENTER}")

Else

MsgBox(4096,"", "The file example.dll does not exist on your computer.")

EndIf

I've changed this quite a bit already...but I would still like to pass on the "search" to the button. Any help would be GREATLY appreciated.

Link to comment
Share on other sites

I am not quite sure I understand what you are after.

What is it you are wanting that script to do? Wait until you press a button to continue?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

The old script is set to just run after asking the user if he/she wants to continue running the prog. It then goes through the predefined dir's and registry listings and then "reports" it's findings. That script works great and has no problems as is. I would like to, however port this over to more of a GUI environment which would have basically three buttons: Scan / Search, Save results, Clear results. There will be a pane adjacent to these buttons that would display all results instead of opening an instance of Notepad to "paste" results into.

The user then would be allowed to save results from here or just clear them. The whole search though must be instigated at the user's "push" of the Search button. The other two buttons work; I just need to be able to script the function of the search parameters to the button.

I don't know if I made that any clearer or not.

Link to comment
Share on other sites

Yea I understand what you are saying. I am currently downloading v.103 to get the GUI stuff all figured out. Once I get to that point I will certianly try to help you! :)

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Here's one way to do it:

; requires latest "unsable" AutoIt 3.0.103 with GUI functions...
GuiCreate("Example")
$buttonSearch = GuiCtrlCreateButton("Click to search...", 10, 10, 200, 100)

GuiSetState()
While 1
   $msg = GuiGetMsg()
   Select
   Case $msg = -3;GUI_EVENT_CLOSE
      ExitLoop
   Case $msg = $buttonSearch
      _doSearch()
   EndSelect
WEnd
Exit

Func _doSearch()
   If FileExists("c:\WINDOWS\system32\example.dll ") Then
      WinActivate("Results.txt", "")
      MsgBox(4096, "", "example.dll exists.")
      ClipPut("c:\WINDOWS\system32\example.dll")
      Send("c:\WINDOWS\system32\example.dll found" )
      Send("{ENTER}")
   Else
      MsgBox(4096,"", "The file example.dll does not exist on your computer.")
   EndIf
EndFunc
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

CyberSlug,

Hey thanks for your help...

I adjusted what you posted to work with what I already had (as far as the $button). I just need to figure out how to take the results, and 1) instead of opening an instance of Notepad, "paste" the results into the GUICtrlCreateEdit box I have. 2) Set the search button / function to go through an entire list of predetermined entries.

For the latter, would I just enclose the additional entries within the "Func _doSearch()" / "EndFunc"?

For the former (#1), I would like to take all results and again, send them to the GUICtrlCreateEdit box instead of to an instance of Notepad. The user would then have the ability, if desired, to save the results from here to a .txt file wherever they wanted. Hope that makes sense.

Thanks again for your help

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...