Jump to content

Greenseed

Active Members
  • Posts

    143
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Greenseed's Achievements

Adventurer

Adventurer (3/7)

1

Reputation

  1. ho sarcasm , i've learned my lesson you won't ear from me on that forum any time soon see ya
  2. i did not realize this was more work (maybe i should go take a look at autoit source)... and the point was to make it simple for you to bring some kind of multithreading to autoit , so forget all about that.
  3. Ok i am rewriting my idea here hope my English will be better. First of all , since this idea is not real Multi-threading , i am going to call Multi-Threading -> AutoitThreading Autoit Dev will need to create some new function , @macro/var for this to work, atm i can think of: ;~ return the Thread ID ;~ $MyScriptToRun could work like FileInstall() and add that script as a resource inside the .exe ;~ and put copy on the hdd before exec or direct mapped to memory , Autoit Dev can answer better than me ;~ if not $MyScriptToRun then default is used and we run another instance of the SAME script we are currently running. NewAutoitThread([$MyScriptToRun]) DelAutoitThread($thread_ID) ; will do a normal Autoit "exit" on the selected script by this thread @AutoitThread = Thread Number , example return 1 cause this is thread 1 @AutoitThreadCount = How many thread did i make with NewAutoitThread()+1 cause we allways have at least 1 AutoitThread with our original script running $SHARED_MEMORY[100] = this variable will be the core of that system , this is how each AutoitThread exchange data between them and this is the var we use to Activate Mutex inside a script. ;~ will loop on $SHARED_MEMORY[$index] ;~ Until var is NULL Or Empty, Call that like you want, ;~ the loop will offcourse Not take 100% cpu cycle ;~ this is far far away from a real mutex who block access To a memory region ;~ but for our need it will work good , Autoit Script dev will need To use that var correctely If they Do Not want stange problem AutoitThreadMutex($index) ;~ Example of using $SHARED_MEMORY Func SomeFunc($SHARED_MEMORY[0]) Local $data = $SHARED_MEMORY[0] $SHARED_MEMORY[0] = "" ;doing this release my mutex Do $data Until EndFunc ;~ Another Example of using $SHARED_MEMORY Func SomeFunc($SHARED_MEMORY[0]) ;now i am holding my mutex until i complete here Do $SHARED_MEMORY[0] Until $SHARED_MEMORY[0] = "" ;doing this release my mutex EndFunc I can think of building a example using 2 .exe and sharing a pointer but i think posting this example break the LUA since i will use a shared pointer into both .exe mean i reverse engineer script for that. And the big job Autoit Dev will have to do is not about the SharedMemory but about starting they script into each thread and a example with 2 .exe will not show anything about that. i hope i am making more sence and i really do not think this is about mental capability but a lot about my communication skill in english.
  4. another idea about the ;mutex i created , it wil be nice if you add a similar function virtualMutex($var) who will loop until var is empty without capping the cpu i think my idea is possible with 2 .exe atm and using DLLGetStruct() to share a memory pointer for sharing data ...
  5. i use NetBeans for PHP, Html, Javascript, css and c++ when i use QT and maybe one day for Autoit i really do love how he manage local project file and source file , he do it like a pro
  6. I know adding multithreading in autoit won't happen anytime soon and i am ok with that with experience we learn to use 2, 3 event more .exe but how about running multiple autoit into 1 process , AutoitVirtualProcessSharedMemory = a array maybe all virtualprocess have access,i think autoit dev know better than me what todo here , a array of mixed value could be great , since the user can define a Global enum and easely keep track of meaning of each index $VP_index(used to maybe to close that thread) = AutoitCreateVirtualProcess() : this function will start a new autoit thread inside the same process and execute another copy of our script , like if we run it for the first time, so no worry about not safe in multithreading @VirtualProcessCount will be == to your thread count Created @VirtualProcess == current running thread if @VirtualProcess = 1 then thread1() if @VirtualProcess = 2 then thread2() func thread1() while 1 ;mutex while AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] <> "" wend AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] = "my db command" If AutoitVirtualProcessSharedMemory[$_DB_COMMAND_OUT] = "for me" Then DoSomething() EndIf wend endfunc func thread2() if AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] <> "" then Local $command = AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] AutoitVirtualProcessSharedMemory[$_DB_COMMAND_IN] = "" ;delete as soon as possible to free my mutex Local $result = MySQL($command) ;mutex While AutoitVirtualProcessSharedMemory[$_DB_COMMAND_OUT] <> "" WEnd AutoitVirtualProcessSharedMemory[$_DB_COMMAND_OUT] = $result endif endfunc Func AnotherFunction() EndFunc i hope i am making sence
  7. Include this script to your actual project and when SUP_Check() is called your script is going to download the next version and self update him self then restart. I am sorry but i did not bother to make a UDF or a more user friendly and flexible module since i still have a lot to go on my initial project 1- inside your project you include thoses line , all together and before your script actual code, beside your log system if you have one #include "self_update.au3" SUP_SetLogCallBack("_log") ; optional , used to send log to your allready log system if success self loggin is disable SUP_SetCheckCallBack("SUP_DownloadProgress") ; optional , will send the % of the download in progress SUP_Start("VALID HTTP URL To YPOUR NEW FILE","DOWNLOAD FULL FILE PATH NAME") ; mandatory 2- Now anywhere in your script you call this line to check for a newer version $fileVersionUrl: is if your using a custom web page to send fast information on the file like version that optional, if empty will always update when check $parentGui="": the self updated will create a gui with a progress bar and try to attach it self to the $parentGui , that optional SUP_Check($fileVersionUrl="",$parentGui="") 3- to check if your script has just restarted after a update if IsDeclared("updateComplete") then ConsoleWrite("Update Complete Sucess Bravo!") endif File: SUP_SelfUpdate.au3 The script can be compiled alone for debug purpose , look for 1 line to uncomment inside the script if running alone #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=e:SelfUpdate.exe #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include-once ;*************** Line to be use inside your own project************ ; ;~ #include "self_update.au3" ;~ SUP_SetLogCallBack("_log") ;~ SUP_SetCheckCallBack("SUP_DownloadProgress") ;~ SUP_Start("e:SelfUpdate_FF.exe",@TempDir&"SelfUpdate_FF.exe") ; ;******************************************************************* Global $SUP_LOGS_CALL[1] = [0] Global $SUP_DOWN_CALL[1] = [0] Global $SUP_URL Global $SUP_FILE Global $SUP_INFO_FILE Global $SUP_DEST_FILE Global $SUP_PID ;**************Uncomment to self debug that script alone************* ;~ SUP_Start(@ScriptDir&"SelfUpdate.exe",@TempDir&"SelfUpdate.exe") ;******************************************************************** Func SUP_Start($SUPURL,$SUPFILE) $SUP_URL = $SUPURL $SUP_FILE = $SUPFILE $SUP_INFO_FILE = $SUP_FILE&".info" if $CmdLine[0] > 0 Then Switch $CmdLine[1] case "update" SUP_InitInfo() if Not ProcessWaitClose($SUP_PID,30) Then SUP_Log("UPDATE - Could not complete since """&$SUP_DEST_FILE&""" will not close",false) Exit EndIf if Not FileCopy($SUP_FILE,$SUP_DEST_FILE,1) Then SUP_Log("UPDATE - Could not copy the new file to """&$SUP_DEST_FILE&"""",false) Exit EndIf Run($SUP_DEST_FILE&" updatecomplete") exit case "updatecomplete" SUP_Delete() ;~ SUP_Log("UPDATE - Complete sucess") Assign("updateComplete",true,2) EndSwitch ;~ Else ;~ SUP_Check() ;for testing to be remove when linked with main EndIf ;~ sleep(5000) EndFunc Func SUP_InitInfo() local $data = FileRead($SUP_INFO_FILE) $data = StringSplit($data,"|") if $data[0] <> 2 Or $data[1]="" or $data[2] = "" Then SUP_Log("UPDATE - Info File is invalid") sleep(4000) exit EndIf $SUP_PID = $data[1] $SUP_DEST_FILE = $data[2] EndFunc Func SUP_Delete() FileDelete($SUP_FILE) FileDelete($SUP_INFO_FILE) EndFunc Func SUP_SetCheckCallBack($funcCallBack) ReDim $SUP_DOWN_CALL[$SUP_DOWN_CALL[0]+2] $SUP_DOWN_CALL[0] += 1 $SUP_DOWN_CALL[$SUP_DOWN_CALL[0]] = $funcCallBack EndFunc Func SUP_Check($fileVersionUrl="",$parentGui="") ;~ if $RUN then return local $version = FileGetVersion(@AutoItExe) local $nextVersion = "always update" if $fileVersionUrl <> "" Then $nextVersion = BinaryToString(InetRead($fileVersionUrl,1)) ;~ SUP_Log($version&" "&$nextVersion) if $nextVersion = "" Or $version = $nextVersion Then SUP_Log("UPDATE - No new version found") Return EndIf SUP_Log("UPDATE - New version found") SUP_Log("UPDATE - Downloading version "&$nextVersion) local $size = InetGetSize($SUP_URL,1) FileDelete($SUP_FILE) local $handle = InetGet($SUP_URL,$SUP_FILE,1,1) local $byteRead, $error = false #include <WindowsConstants.au3> GUICreate("ProgressBar",200,30,-1,-1,BitOR($WS_MINIMIZEBOX,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST),$parentGui) local $progress = GUICtrlCreateProgress(0,0,200,30) GUISetState(@SW_SHOW) local $pct do Sleep(250) $byteRead = InetGetInfo($handle, 0) if @error Then $error = true ExitLoop EndIf GUICtrlSetData($progress,$byteRead*100/$size) $pct = Round($byteRead*100/$size,2) SUP_Log("UPDATE - Percent done: "&$pct) If $SUP_DOWN_CALL[0] > 0 Then For $i = 1 to $SUP_DOWN_CALL[0] Call($SUP_DOWN_CALL[$i],$pct) Next EndIf Until InetGetInfo($handle, 2) GUIDelete() if $error or Not InetGetInfo($handle,3) Then InetClose($handle) SUP_Log("UPDATE - Downloading next version failed") SUP_Delete() Return EndIf InetClose($handle) FileDelete($SUP_INFO_FILE) FileWrite($SUP_INFO_FILE,@AutoItPID&"|"&@ScriptFullPath) SUP_Log("UPDATE - Exiting to complete update") Run($SUP_FILE&" update") if @error Then SUP_Log("UPDATE - Unable to open the new file") SUP_Delete() Return endif SUP_Log("UPDATE - Exiting") sleep(1000) Exit EndFunc Func SUP_SetLogCallBack($funcCallBack) ReDim $SUP_LOGS_CALL[$SUP_LOGS_CALL[0]+2] $SUP_LOGS_CALL[0] += 1 $SUP_LOGS_CALL[$SUP_LOGS_CALL[0]] = $funcCallBack EndFunc Func SUP_Log($msg,$useCallBack=true) If $useCallBack And $SUP_LOGS_CALL[0] > 0 Then For $i = 1 to $SUP_LOGS_CALL[0] Call($SUP_LOGS_CALL[$i],$msg) Next Return EndIf if @Compiled Then MsgBox(0,"Message",$msg) ConsoleWrite($msg&@CRLF) EndFunc
  8. i will propose a patch to both your TCP project both with and without OOP Current Version: ; Check buffer ok $tmp = __TCPClient_CheckBuffer($iClient) If IsArray($tmp) Then For $elem In $tmp If $__TCPClient_Clients[$iClient][$__TCPc_CB_RECV] Then _ Call($__TCPClient_Clients[$iClient][$__TCPc_CB_RECV], $iClient, $elem) Next $__TCPClient_Clients[$iClient][$__TCPc_BUFFER] = "" ;<----------------------------------------------------- ; --- EndIf Proposed: ; Check buffer ok $tmp = __TCPClient_CheckBuffer($iClient) If IsArray($tmp) Then $__TCPClient_Clients[$iClient][$__TCPc_BUFFER] = "" ;<----------------------------------------------------- For $elem In $tmp If $__TCPClient_Clients[$iClient][$__TCPc_CB_RECV] Then _ Call($__TCPClient_Clients[$iClient][$__TCPc_CB_RECV], $iClient, $elem) Next ; --- EndIf if ever the user who use that UDF call process within the Callback _TCP_Recv() he start receiving duplicate data That patch should be apply to "timeout check" also, saving the buffer into a temp val and doing the binary count with that temp val, delete the real buffer data before the callback happen Thanks you very much i appreciate that UDF very much
  9. Salut FastFrench , je suis l'original auteur du core PixelGetColor .au3 et je dois dire que ton approches avec FastFind.dll est super cool tu m'as donnés tout pleind d'idee pour mes futurs project autoit. Donc tout cela pour te dire un gros merci! execlent travail avec FastFind.dll , merci merci Amuse toi
  10. search help on the "net" command on windows system with NT, there you can find usefull command to access other computer... $admin, is a default share normaly Operational on any NT platform, note that on XP , that will be unavailable until you desactivated: "Simple File Sharing".... Start playing with Security from Autoit, you should start know how to do with from Command line or Registry ... event Active Directory , can be a solution ... if you have domain controleur, you can use the simple protocol LDAP to play and access Active-Directory, go see the RFC to know how to make autoit script respond and ask question to LDAP server. And to install stealth a software from Remote, you better have a right permission on firewall and local lan, cause you have to open $ipc, $admin and finaly the Registry, who will be all done auto, if you security setting are ok.. i sugest you, start first creating a user specified for that with admin right, and autoit will do RunAS using that username, that will be compiled inside autoit.
  11. you recursion come from there: "---------> Loop() <------------" Sleep(5000);5 seconds EndIf mapdrive() chkfiles() writetxtfile() ;Add one to $LineCount $LineCount += 1 ---------> Loop() <------------oÝ÷ ÙªÞrêìåz÷¥Ì!z|¨¹Æ¥Ø^~éܶ*'{"u쨹ªÞ)jëh×6func loop() loop() endfunc So what happen, is a new scope called loop, is created inside the scope loop, it is ok to do that, but never more then 250. It a little like looking a mirror from a mirror, you know? image become duplicated inside each other I think from your code, it is not good usage you do, since you recall your loop function. better do a while $notAskedToBreak. What ever, i hope it help you find your way
  12. Nice done! i love converting my Photo and see the result... just for fun so great... You can have a Very, Very, Very, Very big Increase into performance if you drop Usage of PixelGetColor function.... Look here: http://www.autoitscript.com/forum/index.php?showtopic=62681 was trying to play with GetPixelColor but a faster way... look my explanation about why PixelGetColor is slow. And other thing that will solve is: If i grab a 5000x6000 Picture and try convert, you have to put the Picture on the screen for PixelGetColor to work... So working the image into Memory will solve that issue too i don't thing is big work implement that from my script to our... and will be a much more better usage of PixelGet from Dll call, into our script Thx again for that super cool script
  13. Hi everyone... long time i had not done a Autoit script I was just lazy today.. and looking one of my friend playing Guitar Hero III.... im so bad at that game mouhaha! So i started a Bot with PixelGetColor feature, but was not working, since each time i call that function, Autoit Take a complete screenShot from the GDI and search the pixel from there... There is 5 Button, so that mean 5 ScreenShot... not good at all... Then i managed to get 1 ScreenShot and after that reading pixel Color for my 5 region and then Send the right Key Press... The bot is not perfect into that version... since the goal here is to show off a script that can maybe be helpfull for other serious need i saw many ppl searching how to grab pixel color from memory #region opt and variable Opt("SendKeyDelay", 0) ;5 milliseconds Opt("SendKeyDownDelay", 15) ;1 millisecond Opt("SendAttachMode",1) Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon Opt("WinDetectHiddenText", 0) ;0=don't detect, 1=do detect #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <Color.au3> ProcessSetPriority ( @AutoItPID, 4) Global $MemoryContext $Stop = false HotKeySet("{END}", "end") Hotkeyset("{INSERT}", "start") while 1 sleep(7) wend Func stop() $Stop = true Hotkeyset("{INSERT}", "start") DllCall("gdi32.dll", "int", "DeleteDC", "hwnd", $MemoryContext) _GDIPlus_ShutDown () send("{z up}") send("{x up}") send("{c up}") send("{v up}") send("{b up}") EndFunc Func end() DllCall("gdi32.dll", "int", "DeleteDC", "hwnd", $MemoryContext) _GDIPlus_ShutDown () send("{z up}") send("{x up}") send("{c up}") send("{v up}") send("{b up}") Exit EndFunc ; Guitar Hero III: Legends of Rock Func start() Hotkeyset("{INSERT}", "stop") _GDIPlus_Startup () dim $down[5] local $detected $detected = false $MemoryContext = DllCall("gdi32.dll", "int", "CreateCompatibleDC", "int", 0) $MemoryContext = $MemoryContext[0] while not $Stop $HBITMAP = _ScreenCapture_Capture("", 200, 480, 600, 520,false) DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $MemoryContext, "hwnd", $HBITMAP) ;Orange $Color = DLLCall("gdi32.dll","int","GetPixel","int",$MemoryContext,"int",65,"int",33) if BitAND($Color[0],0xFF0000) > 655360 then if not $down[0] then send("{b down}") $down[0] = true $detected = true EndIf ElseIf $down[0] Then send("{b up}") $down[0] = false EndIf ;Blue $Color = DLLCall("gdi32.dll","int","GetPixel","int",$MemoryContext,"int",132,"int",33) if BitAND($Color[0],0xFF0000) > 655360 then if not $down[1] then $detected = true $down[1] = true send("{v down}") EndIf ElseIf $down[1] Then send("{v up}") $down[1] = false EndIf ;Yellow $Color = DLLCall("gdi32.dll","int","GetPixel","int",$MemoryContext,"int",200,"int",34) if BitAND($Color[0],0xFF0000) > 655360 then if not $down[2] then $down[2] = true send("{c down}") $detected = true EndIf ElseIf $down[2] Then send("{c up}") $down[2] = false EndIf ;Red $Color = DLLCall("gdi32.dll","int","GetPixel","int",$MemoryContext,"int",269,"int",33) if BitAND($Color[0],0xFF0000) > 655360 then if not $down[3] then $down[3] = true send("{x down}") $detected = true EndIf ElseIf $down[3] Then send("{x up}") $down[3] = false EndIf ;Green $Color = DLLCall("gdi32.dll","int","GetPixel","int",$MemoryContext,"int",336,"int",33) if BitAND($Color[0],0xFF0000) > 655360 then if not $down[4] then $down[4] = true send("{z down}") $detected = true EndIf ElseIf $down[4] Then send("{z up}") $down[4] = false EndIf if $detected then send("n") $detected = false sleep(80) EndIf _WinAPI_DeleteObject($HBITMAP) sleep(7) wend $Stop = false endfunc
  14. maybe you should try objget() look at this code! you can make it connect to remote active directory, domain or not! then you can check all account in 1 time and autoit can continue to work! the objget() run externaly of autoit process I THINK! then you have a kind of multi-threading look in HKCR(regestry) there are all objget() valide class. the one your are looking for is the one who manage the connection, Active Directory, the class object is "winnt" i found a sample code working with that! im trying to understand more on msdn site but maybe your are good with ADSI call! the code is not the solution you are looking for but point you the direction! not wrote by me. don't know who did. $colGroups = ObjGet("WinNT://" & @ComputerName) Dim $Array[1] $Array[0] = "group" $colGroups.Filter = $Array For $objGroup In $colGroups For $objUser In $objGroup.Members If $objUser.Name = @UserName Then MsgBox(0, "test", $objGroup.Name) EndIf Next Next bye bye hope this help!
  15. here in quebec canada! we also got VOIP phone service by my ISP he give you phone like this! FXS>ISP>CableNetwork(VOIP)>CableModem(Home)>FXS>My normal phone FXO this is not in the band of the internet on your cable modem! this is nice, because there nothing to change in the house you justs have to plug the FXS from cable modem to your line phone in the wall of your house and every phone got is FXS on a voip pretty nice to keep the client changing all equipement for voip solution( FXS > H323 > FXS) bye bye! hope you get 4 line at home and connect freind! hehe im planning for this hehe Grrr LongDistance, here bell charge me about 100$ by month only for longdistance! grrr first time home user has chance to start phone service! hehe have to go bye bye!
×
×
  • Create New...