Jump to content

hackersarchangel

Active Members
  • Posts

    21
  • Joined

  • Last visited

hackersarchangel's Achievements

Seeker

Seeker (1/7)

0

Reputation

  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)
  2. Ok so I am working on a wrapper to launch chkdsk with parameters through a PE enviroment. I have it working as far as executing chkdsk, albeit crudely. The biggest hurdle is getting it to process the log file and make it readable, as it appends to it weird. I'll post a log file shortly, need to test it on both drives to see if it's that different between them.
  3. Ok I'm starting work on a project that will be automating chkdsk under a Windows PE based enviroment. Since the final project will be open source, I'm inviting people to join the team in helping make it a successful project and once it's developed to a 1.0 stage, it will mostly be bugfixes/corrections from there on out. I have already made a basic GUI that I will attach to the thread later when I'm at the computer I have it saved on. The goals of the project: Make a functioning GUI that automatically runs chkdsk after drive selections are madeWill log all output to a location specified by the userWill give options to choose what options to add to chkdsk, /X /R /F being the three biggest ones.An option to run in multiple passes.Anyone that is willing to set aside some dedicated time to sit down, discuss best way to proceed, and help with programming will receive credit where due. Oh and anyone looking to help with bug-testing is welcome as well File attached, I had discovered a mockup I made originally as an example to show a possible layout. checkthatdrive.au3
  4. That I do You guys have always been helpful Ok I'll try this when I have a minute today, have some other things going on. Request thread be closed, going to start a thread about the project in general asking if anyone wants to contribute to the project in an Open Source form.
  5. Ok so I was doing it right, as far as grabbing the variable. So use a For-Next loop to make the boxes that way, so it doesn't complain about being outside of the subscript range? Just making sure I'm understanding this correctly, and that would work.
  6. I have a project I'm working on, as part of a maintenance disk. I want to make a GUI for automating chkdsk startup, as in I run the GUI, then I select what drives I'm wanting to chkdsk. I want to run this from a PE based enviroment, I believe the disk I've chosen is a BartPE based disk, if that matters. Here's where my issue comes into play. When I start the program I have it set to specify a log save location with a Save As box. That part works great, so I have it make the GUI. Here's the issue: When I'm making the GUI, I want it to grab the drive letters and use that as part of either Checkboxes OR multiple dropdown menus. That part I'm flexible on, I just want it to work, and the dropdown menus was just another way of thinking about it. So I figured out how to grab drive letters into an array and do an If-Then for less than 4 drives (test machine has 3 drives, trying to get it work before worrying about whether or not it's less than 2 or 3): Global $Drives[5] = ["1","2","3","4","5"] $Drives = DriveGetDrive("Fixed") If $Drives[0] < 4 Then $Drives[4] = "None" EndIf For some reason, when I run that code, it flips it's lid about being outside my subscript range. I added the ReDim command to resize it back to 5, but that still doesn't work. Now if I set it when I initialize it, it's fine, and I can edit it all I want to manually, just not with DriveGetDrive. Current modified code: Global $Drives[5] = ["1","2","3","4","5"] $Drives = DriveGetDrive("Fixed") If $Drives[0] < 4 Then ReDim $Drives[5] $Drives[4] = "None" EndIf What I would like to do is resize the Array to fix the amount of drives I have, i.e. if I have 2 drives, make it 3 slots big, [0] for the count it generates, [1] for drive 1, [2] for drive 2, etc. and if it doesn't get a reply from slots 3 and 4, disable those checkboxes/remove the entry from the dropdown list. But that is further complicating the issue as it is, just want the basic premise to work. If anyone has any ideas for this little issue, I'm welcoming the ideas.
  7. Wow lol didn't think this would be such a popular concept I'll test the script in a bit, at work and a little busy lol
  8. Ingenius! Grab the section of answers, and shuffle them. I could make a section for the questions, using an identifying system to mark the questions and answer sets together and then pair them up by looking up that answer set then shuffling the answer set afterwards.
  9. Ok so here's my "evil plan" lol: I am working on making a test to help me study for the A+. The idea is that I want to make it modular so I can specify a battery of tests. My bright idea was to make an ini file generator, since that has built functions and a method for sorting. The generator is mostly done, it's a basic one to make multiple choice questions. Here's the tricky bit: I want to be able to mark each answer with 1, 2, 3, and 4 so I can then have the test program grab the answers at random, but still relevant to each question, and not show the numbers so it's harder to tell which ones are which. Example: Q. Who founded Apple Computer, Inc? 1) Steve Ballmer 2)Steve Jobs and Steve Wozniak 3) Bill Gates and Steve Jobs 4) Tom Petty and the Heartbreakers but have that be in a different order everytime I take the test, so I can't cheat even though I'm writing the test lol. I have that figured out as far as how it's organized with the questions, just need to figure out how to grab the questions and answers, but do it in a way that it's not seen in the test, so I can randomize them. So far I'm sure I can randomize the question order, but still not sure on how to keep it from repeating a question. Here's my code so far for the ini generator, the Test portion I'll be working on as soon as I can think of a way to have it pick a question at random. Partially why I'm here #include <GUIConstantsEx.au3> ;Constants for GUI Events #include <WindowsConstants.au3> Global $Answer, $Answer_input[4], $counter = 0, $Build_bttn, $Question, $Question_input _Create_GUI() Func _Create_GUI() ;To implement a reset function, make everything in the GUI first, THEN put all the case stuff inside ;_Main(). HotKeySet("{F3}","_Main") ;A program reset switch, in case a function gets funky and doesn't process right. GUICreate("Question and Answer Generator Version 0.1",640,480) ;The code for adding questions and answers to the .ini file. $Question_input = GUICtrlCreateEdit("Question goes here",45,45, 250, 75) $Answer_input[0] = GUICtrlCreateInput("1)", 45, 150, 300, 20) $Answer_input[1] = GUICtrlCreateInput("2)", 45, 175, 300, 20) $Answer_input[2] = GUICtrlCreateInput("3)", 45, 200, 300, 20) $Answer_input[3] = GUICtrlCreateInput("4)", 45, 225, 300, 20) $Build_bttn = GUICtrlCreateButton("Add to File", 525,440) _Main() EndFunc Func _Main() GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $Gui_Event_Close Exit Case $Build_bttn $Question = GUICtrlRead($Question_input) $Answer = GUICtrlRead($Answer_input[0]) & @LF & GUICtrlRead($Answer_input[1]) & @LF & GUICtrlRead($Answer_input[2]) & @LF & GUICtrlRead($Answer_input[3]) If ($counter) < 10 Then $counter = $counter+1 IniWrite("AlphaTest.ini","Questions","Question_" & $counter, $Question) IniWriteSection("AlphaTest.ini","Answer_" & $counter,$Answer) EndIf EndSwitch WEnd EndFunc I understand this is a complicated project, one I'm willing to share back with the community of course since the idea is to make it a simple generator and then just point the Test exe to the q&a file
  10. @John I just copied your script verbatim, it does not press the ok button for me, it highlights it, makes it the active button, but does not press it. Tried a couple of variations (CLASS:Button, ID:2), Send("[ENTER]"), etc and no dice, however I can certainly press Enter and it goes away. Not sure why this is such a bother, the AutoIt Window program gives me the same ID's and information everytime I run it. Edit: And yes, I am running the unpaid version, fresh install of the program. The version I'm using is 1.6 if that helps, got to thinking that maybe they did something between versions? Added the Opt("TrayIconDebug", 1) line and it's stopping where it's looking for the window. It's not able to grab the window properly, thus unable to click it. However the AutoIt Window Info tool is able to detect the handle of the window, give me information about the button, it's class, etc. Something is interfering with AutoIt's ability to see the window. Probably being done on purpose by Malwarebytes. Edit 2: I feel dumb. There was a change in the name. They took away the apostrophe after Malwarebytes.
  11. What I'm gonna do is compile two .exe's. One that has all the files in it and the commands for recompiling the main .exe. Then I will pack that exe inside the main exe, and when running, unpack the update.exe and then send it a switch to tell it what mode to go into, either to self update, or to just pop out all the files that are needed with the main.exe Some of the other stuff I was just thinking could be useful, I did notice yesterday on the self delete one that when I had it do that it didn't take long to loopback into the machine except in one instance of that where it took it a full 5 seconds to do that Oh and the advantage is that with the way I'm designing the program is that we have some files that hardly ever update, but others that update more often, almost daily, so I'm going to pack the least updated files into the .exe but in the event we encounter an old file that needs replacing from our program, we want to replace that file, then rebuild itself on the fly. Sounds complicated I know, but we want a program that can self maintain and still as much as we can when in transport, not run time, stay as one .exe
  12. Ok so I did a test with the option: FileInstall("Update.ex_","Update.ex_") FileInstall("Update.ex_","Update.exe") and it did not double the size of the file. I used a 4mb file to test with, going to include a bigger file and see if it's any different. Also noticed that FileInstall put the files in the same Dir as the Update.exe unless I specified the subdirectory. Since running commands needs to be spot on, just have to remember to specify that Doesn't change anything though.
  13. So I was looking at the self delete FAQ code and was wondering if there is a way for me to modify that to do a self compile. Basically, I want to be able to take my .exe, run it, have it unpack and change whatever files need changing, then recompile everything back into itself. I considered making a separate .exe so I could auto re-run the main.exe afterwards using a switch ,and I was also thinking I could make a placeholder file so the program would know it was just updated and run anything specific afterwards if I didn't make a separate .exe MsgBox(0,"Start","Starting self-compile attempt.") $iDelay = 0 Local $sCmdFile FileDelete(@TempDir & "update.bat") $sCmdFile = 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & @ScriptDir & 'UpdatesAut2exe.exe /in test.au3 /icon test.ico' & @CRLF _ & 'if exist "' & @ScriptDir & 'Updatestest.au3 goto loop' & @CRLF _ & 'Pause' FileWrite(@TempDir & "update.bat", $sCmdFile) Run(@TempDir & "update.bat", @TempDir, @SW_SHOW) Also, if I make an includes file, to list all of the files that would need including, would that be relative to that file, i.e This code would run the file from the main.exe being in the highest parent folder (like C: for example) ShellExecute(""Subfolderincludedsubfolderfile.exe" But in my subfolder: (example C:UpdateFileInstall.au3 and C:Updateextra_filesfile.exe) FileInstall("extra_filesfile.exe", "file.exe") If I was to #include that file into my main.exe, would it be placed in the right folder? I'm gonna test that theory in a bit, and post my findings. The basic thing is that if I was to re-compile the script, since that has to be a literal string, would prefer to not have to do a bunch of checking for those files to be in the right place lol. As I'm running this through my head, I'm realizing that one option would be to compile that into the other .exe (update.exe) and then just have an extract all switch like /e. Basic breakdown as I see it in my head: have the main.exe compile FileInstalling only the compiler and the update.exe files. The main.exe file would then extract the update.exe file and by default it would extract all files needed for running the sub programs. When going to update I would pass a switch /u to it so it would update any files, then recompile the main.exe. This is where the my need to possibly pass the command via the loopback into the computer would be needed. My testing shows that when going to run the compiler I need more time between the time I pass the command and the time it starts compiling due to it trying to pack the update.exe file and causing the compile to fail. One option I thought of was to do: FileInstall("Update.ex_","Update.ex_") FileInstall("Update.ex_","Update.exe") but someone else didn't like it because they was thinking it would double the size of the file. I'm gonna test that theory in a minute as well after I finish making my final edit xD Ok sorry for the massive post but this is a unique to me concept and was wondering if anyone else found this idea interesting and also had any advice.
  14. Was gonna ask how this differs from MemGetStats() but I figured it out, but just in case someone else wonders: MemGetStats() shows the reported memory amount, after what is left through sharing. So if I have 4gb of memory, but it's sharing half a gb, then MemGetStats() reports 3.5gb. This grabs the actual installed amount. (You can correct me if I'm mistaken.)
  15. Ok the ProgressOn version is fully functional and works awesomely For the moment that works great for me and I'll probably make a function and include that into the function and when I get it fully working, I'll share the base code with you so you can see just how I'm using it. I'm a big believer in giving credit and letting the original creators know when I'm using their code if I use it in a big way. Edit: I feel dumb. I didn't copy the whole GUI example script. Also, when I purposely disconnect from the internet to test the error side of things, leaving it as stock as possible, just changing to suit my purposes, it just says "Succeeded" but quits quickly. Gonna compile it to see if it's different. Edit 2: After compiling and watching the directory, I noticed it's not getting from the internet but it's storing it somewhere because it's pulling it into that folder and it runs. I looked at the code and I didn't see anything that jumped out at me saying you added the ability to save a copy somewhere in case the download fails or something.
×
×
  • Create New...