Jump to content

dmkirkland

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by dmkirkland

  1. So, I'm appealing to the experts once again as I'm at my whit's end. I have written a script that processes different files and folder and creates a backup of those files using the 7za.exe file. The archiving process works perfectly. My cleanup process to remove all but the last 3 copies of the archives also works flawlessly. The issue I'm having is that it seems the script, contrary to what I assumed and hoped, seems to process without stopping. It will start the archiving processes simultaneously even though the commands are on separate lines. This presents a huge problem because the last step in the script is to have it cleanup a Temp folder created at script invocation. That Temp folder seems unable to be deleted because the files in that folder (yes they're totally different folders) seem to be in use when the script exits. I've read that AutoIT is not capable of forking or multi-threading (which now seems untrue). I don't mind the archiving processes running in parallel but if the cleanup process attempts before the archiving is complete and the temp files are ready to remove, the folder is not removed as planned which presents a problem for the cleanup process. Did I miss something with the capabilities of AutoIT in relation to forking or multi threading?
  2. I know it's been a while. I've been on TDY in Germany. @BrewManNH, I'm wondering, now that I understand from your post what is happening (and suspected as much but wasn't sure), are you aware of a way to somehow "tag" or "assign" the "subprocess" of " system" a variable or something that I can cause the script to wait for? I'm assuming if I do something akin to $window = ShellExecuteWait("control", " system") that the variable will get assigned to the "control" execution, not the subprocess " system"?
  3. I'm having a very frustrating time with this one. The function seemed to work just fine for a little while but now it doesn't. If I run it like this Local $fileCheck = FileFindFirstFile (@ScriptDir & "886*dat.exe") MsgBox (0, "", $fileCheck) it pops up with a -1 which the help file indicates means it didn't find a file matching the specifications. If I change it to this Local $fileCheck = FileFindFirstFile (@ScriptDir & "\886*dat.exe") MsgBox (0, "", $fileCheck) it throws a 1 which the help file indicates means the directory is empty. I have quadruple (or more) checked the folder...the file I want it to find is in the directory. If I have a box generated to indicate the @ScriptDir, it gives me the proper path (the folder where this file is located). This happens even if I narrow down the argument to Local $fileCheck = FileFindFirstFile (@ScriptDir & "*dat.exe") MsgBox (0, "", $fileCheck) I could have sworn this worked exactly the way I wanted it to at least 3 times during testing. I was working on using the same code snippet/concept to provide additional functionality and I was having a hard time with it so I checked this one and it wasn't working now either. I'm totally stumped and I have gone as thoroughly through the help file on the particular function to no avail. I have multiple includes in my file ; *** Start added by AutoIt3Wrapper *** #include <AutoItConstants.au3> ; *** End added by AutoIt3Wrapper *** #NoTrayIcon ;~ #RequireAdmin #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Inet.au3> #include <Constants.au3> #include <Process.au3> #include <WinAPIShPath.au3> #include <Array.au3> #include <IE.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> so I don't think I'm missing to make this function work. If needed, I can post the entire code, so let me know.
  4. Wondering if someone might know why, with the below code, when the first function is run (looking particularly at the middle part of the function with the ShellExecuteWait), msinfo32 (which runs fine from a Run box) pops up as the main window disappears. The main window reappears once msinfo32 closes, as expected. When the "control system" command is executed, however (which again, runs fine from Run box), the new window appears when the main window disappears but, the main window pops back open again (in the background). It's baffling me. The only reason I can think of is that "control system" is really a command with an argument and that Windows application is actually a "subset" of sorts (or appears to be) of the explorer.exe program in Windows. So, if I'm right, maybe, in addition to confirmation, someone might know how to make the main window actually hide until the "control system" application closes? Func systemInformation() WinSetState ($mainWindow, "", @SW_HIDE) ShellExecuteWait ("msinfo32") WinSetState ($mainWindow, "", @SW_SHOW) EndFunc Func runSystemProperties() WinSetState ($mainWindow, "", @SW_HIDE) ShellExecuteWait ("control", " system") WinSetState ($mainWindow, "", @SW_SHOW) EndFunc
  5. I'm wondering if, once again, I might be able to get some assistance from those of you who are much more knowledgeable than I. I have written a function that uses an InputBox and asks for the name of the adapter the user wants to manipulate. The script is designed to assign the name of the adapter to the entire program (a global variable) for use in other functions throughout its use. It can also be called again to change the adapter or, if it mistakenly didn't get set, set it. The issue I'm having is that I can't figure out a way to keep the function from "clearing" or "deleting" the variable if the cancel button is pressed. The idea is that if the user assigns the variable at the start of the program running (the function is called before anything else happens in the script) then, mistakenly/accidentally, runs the function again and, at the InputBox, the user clicks "Cancel" it will leave the variable alone. Currently, I've been able to (after much trial, tribulation, and troubleshooting) get it actually cancel the operation when "Cancel" is pressed or assign the variable as needed/preferred when the information is entered and "OK" is pressed. However, if "Cancel" is pressed (again, after the variable has already been assigned), it completely clears the variable's assignment (as evidenced by calling the variable in another function. Below is the code for the function. Please let me know if more functions are needed for diagnosis. Func selectAdapter() Global $adapterName $adapterName = InputBox("Select Adapter", "Please input the adapter name" & @CRLF & @CRLF & "or leave it at the default:", "Ethernet") If @error = 1 Then Return EndIf EndFunc
  6. Ok, I'll have a deeper look at the large script you've got there. Back to the smaller (original) one. I guess one question I have is the [variable].ExecQuery and [variable].IPAddress. Are these "sub commands" of some sort that AutoIT knows or are they part of WMI commands?
  7. Ok. So I've been analyzing as much as possible...I'm really trying here guys. So from what I've read about arrays, it seems Ubound "strips" out unnecessary/unused elements in a variable? Which I assume is what is being used to eliminate "non-entries" from the ObjGet("WMI Command")? I still don't understand the WMI side of things at all. I tried to figure it out. The hard part with that is that I can' seem to find a way to see what WMI/wmic does/how it works. I understand the concept of it, to a degree. But I can't figure out a way to just pop up a CMD window and try stuff out/see what happens. I think that's one of the bigger hangups I'm having. The other one is seeing in the script how it breaks down and displays only the IP Address for a connected and valid interface. I did play with the script and if I change the end of the Ubound line to - 0, I get what seems like the entire list of IP's (valid or not) from all the interfaces on my machine. Conversely, if I change the end of the same line to - 2 I only get my IPv4 address whereas before I got my IPv4 and IPv6 address (v4 address in one box, then v6 address in a subsequent box). I really wish this would just click for me. I hate bothering you guys with novice stuff.
  8. Ok, I'm reading through the pages you (Bilgus) linked. While I'm trying to digest, I think I have one more question that I don't seem able to answer from all the material I have: is it WMI that the script uses to determine the "active" network adapter or is it something else in the script? I really want this to be the last question I ask but I'm afraid I might have more as I dig deeper and understand better.
  9. I think I'm tracking a bit. But how does the script know which value to pull and subsequently which network adapter has an actual IP address assigned to it? I ask this because I have 4 network adapters but only 1 has its IP address shown at the completion of this script.
  10. Well, except on a basic level that an array contains a group of items. Just wondering what that "group" is in this case and maybe where those "items" are derived?
  11. I guess a better question for me, might be what is an array, in layman's terms? I'm not quite sure I understand an array fully.
  12. Oh, and what is $IPConfig.IPAddress? Is ".IPAddress" a function of some sort?
  13. Ok, so then my next question is, why the need for going through the array to retrieve all the strings? Shouldn't there be only one response generated by the previous command? I'm referencing the (Not trying to be confrontational-just trying to understand :-))
  14. I guess one question I can ask now is why would there be need to assign variable to variable to variable? It seems this is frequently done with most scripts I've downloaded and tried to analyze. It seems redundant and overly complicated in some cases. The beginning of the script for this one assigns a variable to the computer you want to ping, then assigns a variable to the results of the ping on the variable previously assigned....seems overly complicated to me (again, to me) but I can't wrap my head around why it would be necessary or helpful to compound variables in that way. Tiny brain...lots of information... :-)
  15. I've used the command prompt method in the past. It works but unfortunately requires knowledge of the adapter name for the interface you wish to change. That's why I wanted to understand better what was happening in the script in hopes to reverse engineer it, learn more options and apply what I've learned to a script to set the IP in the same/semi-reverse fashion. I will analyze it and see if I can post tonight what my dissection of it would be. Thanks.
  16. Actually both. Most importantly, I would really like to understand the script I pasted before...in complete detail. I feel like if I understand it line for line I will be better suited to helping myself with the other part of this project. I'm basically going to be putting together a small GUI with multiple buttons. The first will set one IP on the PC, the second, another IP and so on (essentially 25 different configs). But I will only be setting IP and Subnet Mask. My only worry is that if I understand how the "Get IP" script pasted above works, it may not offer me enough insight into creating the "Set IP" script (but I plan to cross that bridge if I come to it).
  17. On a side note, my mission is to accomplish a very simple script that sets a specific ("hard-coded") IP address along with a subnet mask (only these 2 items will need to be set-no gateway, no DNS). No request for input will be collected.
  18. Sorry. I clearly did not read the rules for the DEV forum.
  19. I have a script I downloaded from the forums here that works as advertised. It displays the IP address of a connected interface by "polling" (?) WMI. I'm relatively new to using AutoIT but have been able to adapt many scripts I have found here to do exactly what I have wanted to do in the past. Most notably, I have determined how to utilize CMD in Windows to send a netsh command to set the IP address. Not very pretty, but effective. The disadvantage (as I'm sure many/most/all of you know is that you have to know the interface name in order to utilize this command. Not very easy to use to provide a simple script for a novice user. I have learned WMI seems much more effective and user friendly but, although I can find a script or 2 to display IP address and have found a couple to set one (not entirely the way I prefer but works), what I really want is to understand, step-by-step, how/why the script works so I can further my knowledge and keep from bugging everyone here on the forums as much as possible (I'm a big proponent of "teaching a man to fish"). I just can't figure it out entirely. Below is the script. And I thoroughly apologize for the novice request. I'm sure you guys have better problems to solve but I'm at my whit's end with learning this. Local $IPConfig $strComputer = "localhost" $ping = Ping($strComputer, 500) If $ping Then $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $IPConfigSet = $objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration ") For $IPConfig in $IPConfigSet If $IPConfig.IPAddress <> "" Then For $x = 0 to UBound($IPConfig.IPAddress) - 1 msgbox(0,"Current IP","Your IP address is " & $IPConfig.IPAddress($x)) Next EndIf Next EndIf
×
×
  • Create New...