Jump to content

Search the Community

Showing results for tags 'FindFirstFile'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. EDIT!!! See code below for solution. I had to Return the variable to outside the function. Ok so I'm having an issue with AutoIt retaining a variable value from a function. This is the scratchpad code I came up with based on the example in the help file. If you run the code, it finds the file in the directory specified while in the function. When I exit the function to go into the next part, which is executing the file, the variable is blank. I did a quick search thinking that all I needed was to make the variable global, but that did not work. So I then declared it Global while in the function and that did not work as well. I'm basically making a tool I can run on multiple machines to help keep them updated, from a server share. I can copy the files down no problem, I'm just looking for a way for it to remember the name of the .exe it pulled and run it with the switches for silent/unattended updates. I have another method, but it's much more complex and bulky in comparison to this because it uses FileInstall to extract the files, then it runs the update tool manually at user request, then runs the updates, and finally it rebuilds itself if updated. Works great if you need an offline option but I'm going for K.I.S.S. with this one. $program = $Searchdir & "AdbeRdr*.exe" Func _Search($program) ;Debugging box MsgBox(48,"Info",$program) $search = FileFindFirstFile($searchdir & $program) ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) $run = $file If @error Then ExitLoop ;Debugging box MsgBox(4096, "File:", $file) ; !!! The solution !!! Return ($file) WEnd EndFunc ;Checking to make sure the variable remained intact ;This is where it fails because it's not retaining the value needed. MsgBox(48,"Info","File is: " & $file)
×
×
  • Create New...