Jump to content

JustSomeone

Active Members
  • Posts

    86
  • Joined

  • Last visited

JustSomeone's Achievements

  1. Awesome, thanks. Edited it a bit so i can click the >> or << button without selecting and it works too (adds the first value from the list)
  2. Hola amigos, I am having a nightmare with two combo boxes, and two buttons << and >> to move data between them. If someone ever did such thing, can i get some help, because the more i write it , the more i understand i'm doing it wrong. I made some small example (copy-pasted some stuff, ignore the variable namings) so i can show what i need. Example is working one I'm having an 2d array, containing the data i need , and using the method below to set it in the combo box. So far the ">>" button works, but i'm 100% sure this is some good example how bad i am at programming . I need to make the "<<" button works aswell, but looking at the _ButtonAdd() function i start to think of suicide. Please help #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $aListControllers[5][2] = [["01", "Door1"], ["02", "Door2"], ["03", "Door3"], ["04", "akhsd"], ["05", "asshd"]] ;Stripped GUI example #Region ### START Koda GUI section ### $Form1 = GUICreate("test", 551, 273, 274, 218) $controllerlist = GUICtrlCreateList("", 233, 10, 113, 190, BitOR($GUI_SS_DEFAULT_LIST, $LBS_EXTENDEDSEL), $WS_EX_CLIENTEDGE) $buttonadd = GUICtrlCreateButton(">>", 374, 69, 27, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $buttonremove = GUICtrlCreateButton("<<", 374, 101, 27, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $userlist = GUICtrlCreateList("", 418, 10, 113, 190, BitOR($GUI_SS_DEFAULT_LIST, $LBS_EXTENDEDSEL), $WS_EX_CLIENTEDGE) $savebutton = GUICtrlCreateButton("Save", 320, 224, 75, 25) $cancelbutton = GUICtrlCreateButton("Cancel", 408, 224, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $a = "" For $x = 0 To UBound($aListControllers, 1) - 1 Step 1 $a &= $aListControllers[$x][0] & "-" & $aListControllers[$x][1] & "|" Next GUICtrlSetData($controllerlist, $a) GUICtrlSetData($userlist, "") ;striped func just for the example Func _ButtonAdd() Local $aSelectedValue = GUICtrlRead($controllerlist, $GUI_READ_EXTENDED) If StringInStr($aSelectedValue, "-", 2) > 0 Then $aSplitedValue = StringSplit($aSelectedValue, "-") $b = _ArraySearch($aListControllers, $aSplitedValue[2]) _ArrayDelete($aListControllers, $b) Local $a = "" For $x = 0 To UBound($aListControllers, 1) - 1 $a &= $aListControllers[$x][0] & "-" & $aListControllers[$x][1] & "|" Next GUICtrlSetData($controllerlist, "") GUICtrlSetData($controllerlist, $a) GUICtrlSetData($userlist, $aSelectedValue) Else Return EndIf EndFunc ;==>_ButtonAdd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $cancelbutton, $savebutton Exit Case $buttonadd _ButtonAdd() EndSwitch WEnd
  3. I have no idea on how Selenium etc works, i posted the example above tested with other software. Your problem is that most likely Selenium is pausing itself once it run the firefox driver (therefore waiting for it to quit so it can proceed) AutoIT have similar behaviour, functions are Run and Runwait, most likely this is the issue with selenium too. If you are running the exe before firefox, make sure to give it enough time (or retries) so it does not exit before the firefox page is done loading. In what order you run the firefox driver and the autoit exe it's fully on you and what your program should do. Also a sidenote, storing password inside code is not very secure, there is plenty of people capable of reverting your program.
  4. Your autoit script is most likely still working (not exited or waiting for something) and you cannot delete it. Use this code as autoit code, change your username & password fields, and if needed adjust the Sleep(500). What this code do - upon launching, tries 20 times to locate the auth window of firefox. If the window is not found - it exits with 1, if it's found - exit with 0. If your page is slow loading one - you should delay launching of the Autoit exe with enough time so your page can load. If you get an UAC prompt, remove the first line of the code (#RequireAdmin) or comment it with an ; #RequireAdmin ; unsure if it's needed Opt("WinSearchChildren", 1) $sUsername = "someusername" $sPassword = "somepassword" Sleep(1000) For $i = 1 To 20 Step 1 Sleep(500) $sTitle = WinGetTitle("Authentication Required") If $sTitle = "Authentication Required" Then Send($sUsername & "{TAB}" & $sPassword & "{ENTER}") Exit 0 Else ContinueLoop EndIf Next Exit 1
  5. I used pure task scheduling since i did not had an running proccess under the SYSTEM account since startup (i didn't need it). My mistake, i didn't properly read the entire thread. However, it's interesting for me so i'll watch the thread, and read bit more about the matter, if i come up with something, i will post it EDIT: I briefly remember something about GUI stuff (even fake ones) not working / not recieving calls at all under SYSTEM account, but i really can't remember the issue now. I will search for some links.
  6. Since i smell gamebot or similar here, i will just give you a hint Use the autoit option for PixelCoordMode with combination of PixelSearch() to get the exact coord where the color is found. Post your code and sample image, so we (i) know bit more what exactly has to be done.
  7. Let me jump in, Put this on top on your script : Opt("WinSearchChildren",1) then WinWaitActive("Authentication Required", "") Send("Username{TAB}Password{ENTER}") And you are good to go EDIT: for more info visit the help file, or https://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm#WinTitleMatchMode
  8. Can you post bit of the code, few days ago i did something similar, and upon the event i can even manage to connect to a DB, update some records and return for like half an second, so writing a line to a file should not be a problem, at all. Also, you can try and opening the file with FileOpen(), write to it with FileWriteLine() then close the file with FileClose(). Depending on your file, i believe it will be alot faster than passing the filename directly to FileWriteLine(). If your program is intended to write a file upon user's session end, you can just task schedule it, events that i use (and i know working) are System\User32\1074 and system\winlogon\7002. (see attached screenshots 1 and 2). And for action i use the exe (stored in random folder of your choice, screenshot 3). EDIT : i personally believe it's better to taskschedule the logout instead of having something waitining for the event to appear. Screenshot 1 Screenshot 2 Screenshot 3
  9. My 2 cents while reading this: Autoit options SendKeyDelay and SendKeyDownDelay should be checked when using send(). Some programs do require a bit (say 50 ms down and 30 between keys) more time so they register an actual button being pressed. If you send for example "someverylongstring" you may end up with "smeerylongstrng" or similar. Again , it really depends to what program you are sending text/buttons etc
  10. This is what you need. It work perfectly with mysql servers. I suggest building the dll yourself from the include, since including that giant dll in the program is pfft. If you need more help, provide some code for a start.
  11. It does not hang, it continues it's work, so i assume sleep changed, and controller did not had enough time to respond. I cannot use bigger than 3000ms sleeps there because the program is also doing other things, and if i delay too much it will cause error at other stuff, so i believe the sleep funct is causing it, because everything else seems to work. Restarting the autoit program fixes the problem (there is few other functions, calling the same plink program and they also behave like this, no reply from controller)
  12. It does not work with putty, only with plink. I've tried running it with putty for ages and failed. Since i don't have code in hand, i will describe how it works - open putty, save some session, then launch the plink proccess with the same session name. Write to sdin, wait some time , close proccess and then read stdout and stderr. #include <constants.au3> ; not sure where was the child stuff stored $somepid = run("c:\path\to\plink.exe -batch NameOfYourStoredConnection ","c:\path\to\", @sw_show $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD) StdinWrite($somepid,"do stuff here") sleep(100) ProccessClose($somepid) ProccessWaitClose($somepid) $Output = StdoutRead($somepid) $Error = StderrRead($somepid) consolewrite("output - " & $Output & @CRLF) consolewrite("error (if any) - " & $Error & @CRLF) exit Something like this (quick writed in box, hope you get the idea) Edit : typos, i need english dictionary
  13. It's most likely stupid question, but it seems i can't handle it Question : What does happen with sleep() after say 3 days runtime of a gui. Is it reliable, or i can just get rid of that buggy thing and setup a timer. Does it actually count xxx ms or it's not that accurate Problem : on a program that open connection via plink to COM1 with sdin/out etc of plink, sends some stuff, and wait 2500ms, closes the plink proccess and reads the stdout then do stuff according the reply. Since the thing that respond on COM1 is quite buggy(sadly not at this case), we left this program with the issue for a while, tested with other controller etc, but after around 24-48h controller stop giving output. Restarting the AU3 program (compiled, latest stable, no upx, no antivirus etc) cause the problem to dissapear for another 25h or so. I did some testing and loggin, and i seems i cannot figure it out. Why it stop giving its goddamn output and why after restart it runs as expected ? PS sorry if question / problem is stupid, but it's causing alot nerves over here Posting the function, but i believe its not possible to reproduce it, since you don't have the controller to test it out. I'm 10000% sure it's not the controller itself (or the com1 connection) Func _dummyFunc() Local $aTestAttempt = 0 sleep(1000) If ProcessExists("plink.exe") Then _FileWriteLog($aLogFile,"found some plink proccess, force closing it.") ProcessClose("plink.exe") ProcessWaitClose("plink.exe") sleep(500) EndIf Do Local $iPID2, $sOutput2, $sError2 $iPID2 = Run($plinkPath & $plinkName & " " & $plinkParams, $plinkPath, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD) If @error <> 0 Then Local $anErrorVar = @error Local $anErrorExtendedVar = @extended TCPSend($sSocket[$cSocketNum], "ERROR" & ":Cannot connect to controller Error code is " & $anErrorVar & " and extened code is " & $anErrorExtendedVar & @CRLF) _FileWriteLog($aLogFile, "Cannot connect to controller. Error was " & $anErrorVar & " Extended code was " & $anErrorExtendedVar) ProcessClose($iPID2) ;~ Return EndIf StdinWrite($iPID2, $cCommand & $cContrNum & $cDummyCommand & @CRLF) Sleep(2500) ProcessClose($iPID2) ProcessWaitClose($iPID2) $sOutput2 = StdoutRead($iPID2) $sError2 = StderrRead($iPID2) $dummyResult = StringTrimRight(StringTrimLeft(StringStripCR($sOutput2), 1), 1) _FileWriteLog($aLogFile, "Waking up the controller. Result - " & $dummyResult) $aTestAttempt = $aTestAttempt + 1 If StringCompare(StringRight($dummyResult, $dummyLenght), $dummyValue) <> 0 And $aTestAttempt = 4 Then _simpleEmail("Cannot wake up controller after 4 attempts. Please check it.") Until StringCompare(StringRight($dummyResult, $dummyLenght), $dummyValue) = 0 OR $aTestAttempt = 4 Return EndFunc ;==>_dummyFunc
  14. Hi, Getting error upon running the commexample script "....CommgExample.au3" (172) : ==> Subscript used on non-accessible variable.: For $pl = 1 To $portlist[0] For $pl = 1 To $portlist^ ERROR Added a #AutoIt3Wrapper_UseX64=n ontop on the script, because i'm running a x64 windows7, error still exists. Any suggestions ? EDIT: running latest version of AutoIT3
×
×
  • Create New...