Jump to content

destro

Members
  • Posts

    6
  • Joined

  • Last visited

destro's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi all, Since upgrading from version 3.3.0.0 to 3.3.2.0, I am finding that when compiling my scripts I no longer get the little Windows Security shield overlaid on my compiled .exe icon (to indicate that UAC will be invoked when running) and I have to right click on the script and say “Run as Administrator”. I am using windows 7 Ultimate and have the header like below exactly as I used to before. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_res_requestedExecutionLevel=highestAvailable #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Are there any changes that have been made in the latest release I wonder that may cause this behavior? Thanks in advance
  2. Hah, that's awesome! Why try to reinvent the wheel. Gives me exactly what I need
  3. Hi, I have looked through the forum and not come across a solution to this particular issue that I am having. I am trying to get all of the information possible from certain areas of the WMI. My idea was to have some code like this: $objWMI = ObjGet("winmgmts:\\localhost\root\CIMV2") $objItems = $objWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", 0x10 + 0x20) If IsObj($objItems) Then For $objItem In $objItems ConsoleWrite("Manufacturer: " & $objItem.Manufacturer & @CRLF) ConsoleWrite("Model: " & $objItem.Model & @CRLF) ConsoleWrite("Name: " & $objItem.Caption & @CRLF) ConsoleWrite("Description: " & $objItem.Description & @CRLF) Next EndIf The problem I have is that I don't want to have to know the name of every value that I want to query. I just want to get ALL the values that are in the class. For example, in the above Ihave used $objItem.Manufacturer, $objItem.Model, $objItem.Caption and $objItem.Description. The problem is that I don't always know what is in there so I just want to dump ALL of the values without having to look up each one individually. Is this possible?
  4. Ok guys, I actually went back to my original code as Zodiac's script wasn't giving me quite what I wanted (I couldn't seem to Return the value out of the function that I was after). I took on board the comments that you guys suggested and came up with the following code Dim $SearchFile = "iexplore.exe" Dim $StartDir = @ProgramFilesDir $FilePath = FileSearch($SearchFile, $StartDir) MsgBox(0, "FilePath", $FilePath) Exit Func FileSearch($SearchFile, $StartDir) Local $Search, $RFString = "File not found" $Search = FileFindFirstFile($StartDir & "\*.*") If @error Then Return $RFString ;Search through all files and folders in directory While $RFString = "File not found" $Next = FileFindNextFile($Search) If @error Then ExitLoop ;If folder, recurse If StringInStr(FileGetAttrib($StartDir & "\" & $Next), "D") Then $RFString = FileSearch($SearchFile, $StartDir & "\" & $Next) Else If $Next = $SearchFile Then $RFString = $StartDir & "\" & $Next EndIf WEnd FileClose($Search) Return $RFString EndFunc ;==>FileSearch This works a treat and gives me exactly what I was after. Thanks again all
  5. Thanks very much to all who came up with ideas for this. I've kinda scrapped my original function although it was very useful as a learning exercise (my first one!) as Zodiac provided a very elegant solution to the problem. Next on the list, recursive registry searching...
  6. Hi all, I've been trying to get my head round Functions and decided to try to modify some code to do some recursive folder searching for a particular file. The code takes a file to search for and a root directory and searches for the file and returns the full path. Here's the code: Dim $SearchFile = "bod_r.TTF" Dim $StartDir = @ProgramFilesDir Dim $SearchResult = 0 $FilePath = FileSearch($SearchFile, $StartDir) MsgBox(0,"FilePath",$FilePath) Exit Func FileSearch($SearchFile, $StartDir, $Depth = 0) If $Depth = 0 Then Global $RFString = "" $Search = FileFindFirstFile($StartDir & "\*.*") If @error Then Return ;Search through all files and folders in directory While $SearchResult = 0 $Next = FileFindNextFile($Search) If @error Then ExitLoop ;If folder, recurse If StringInStr(FileGetAttrib($StartDir & "\" & $Next), "D") Then FileSearch($SearchFile, $StartDir & "\" & $Next, $Depth + 1) Else ;Append filename to master string $RFString = $StartDir & "\" & $Next EndIf If $Next = $SearchFile Then $SearchResult = 1 EndIf WEnd FileClose($Search) If $SearchResult = 1 Then Return $RFString Else Return "File Not Found" EndIf EndFunc ;==>FileSearch The problem is that I can't seem to work out a way to use the function without declaring the $SearchResult = 0 first. This is annoying as it means the Function is not self contained. The $SearchResult is used to keep the While loop alive and also to determine what is returned. If I Dim it inside the fuction then it breaks it (Returns File Not Found). Any more experinced people got any idea how I can make this work so it's self contained so i can start to build my own #include file. Thanks
×
×
  • Create New...