Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/21/2018 in all areas

  1. Subz

    Optimize the code

    You'll noticed that imported the entire sheet into an array and then just used this rather than reading/writing to Excel, once it finishes the loop it writes the $_oExport array to Exclusions Excel file. I also added links to your final Window so you can open the .txt and Exclusions.xlsx file directly. You may want to change the iFormat of the _Excel_BookSaveAs function when I ran through your code, I was given an error that it was incorrectly formatted, so changed it to xlsx.
    1 point
  2. Jos

    stringregexp only number

    I am seriously wondering when you are going to be able to post a runnable script as reproducer to avoid others to first do work for you to be able to help? Is it really that hard? So post a simple example like this to reproduce: $HtmlPage = '<span class="txt-big">€</span></span> </div> <span class="item-detail">6 <small>m2</small></span> <span class="item-detail">120 <small>m2</small></span' $aLSuperfice = StringRegExp($HtmlPage, '">\d++ <small>m2</small>', 3) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aLSuperfice = ' & $aLSuperfice[0] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console That would aloow us to cut and paste and test and then reply: is this what you wanted?: $HtmlPage = '<span class="txt-big">€</span></span> </div> <span class="item-detail">6 <small>m2</small></span> <span class="item-detail">120 <small>m2</small></span' $aLSuperfice = StringRegExp($HtmlPage, '">(\d+) <small>m2</small>', 3) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aLSuperfice = ' & $aLSuperfice[0] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console This is the last time I will put in the effort to help unless the question is posted in a way it is easy to support! Jos
    1 point
  3. $nFile_Array = UBound($aFile_Array) Dim $aTmp[$nFile_Array] $iFile_Array = 0 For $i = 0 To $nFile_Array - 1 If Not $aFile_Array[$i] Then ContinueLoop $aTmp[$iFile_Array] = $aFile_Array[$i] $iFile_Array += 1 Next ReDim $aTmp[$iFile_Array] $aFile_Array = $aTmp
    1 point
  4. Guess this got lost for the OP as there still isn't much information to go on... Jos
    1 point
  5. Here is a complete example of combining Autoit with PHP and MySQL was written by me. Include: Sign in, sign out.Create, read, update and delete data between client (AutoIt) and server (PHP/MySQL).Only allow user to log into a client at the same time. Video demo: https://www.youtube.com/watch?v=gQyfXLO0pls Screenshot (Main GUI) Usage If you want to test on your computer, you will need to create a localhost. I recommend to use WAMP or XAMPP. First, create a new database by importing from SETUP.sql file (see video for more info). Then, edit your path to SERVER in AutoIt-PHP-MySQL.au3: Global Const $SERVER = 'http://localhost/AutoIt/index.php?act='Make sure you have copied all files in the folder "PHP + MySQL" into a folder named AutoIt in your Localhost (www or htdocs directory). Yeah, now you can open the file "AutoIt-PHP-MySQL.au3" and try it yourself! Default username and password is: admin Download: Tutorial-AutoIt-PHP-MySQL-v1.0.rar[Tutorial] AutoIt - PHP - MySQL v2.0.zip (Thank @JohnOne for having suggested using zip format)Changelog ----- Hope you enjoyed it!
    1 point
  6. @uzzy33, Why not use the KODA tool to import your script? Then you can paste in the additional functions later.
    1 point
  7. @FrancescoDiMuro No apology necessary...:) I probably should have been more clear upfront. TBH, I was a little nervous after reading all the rules and just wanted to be as short and to the point as possible. Next time I'll include a little more information for sure...:) Thanks again for the offer to help! I'm just learning AutoIt and I love it! It's very easy to understand, but I'm sure I'll have questions in the future so it's nice to know there are people around to ask. And while I don't know very much yet, I will spend some time here in case I can be of help to someone else...:) Thanks again! Take care!
    1 point
  8. Help file : AutoItSetOption where all 30 Opt() are clearly explained + a grouped example in the end. 28 Opt() are correct : their default is the same in their explanation and in the final example. 2 Opt() show a default which is not the same in their explanation and in the final example, they are : SendKeyDownDelay : Time in milliseconds to pause (default=5) Opt("SendKeyDownDelay", 1) ;1 millisecond WinSearchChildren ; 0 = (default) Only search top-level windows Opt("WinSearchChildren", 1) ;0=no, 1=search children also The help file should probably be updated, so all 30 Opt() will show the same default in their explanation and in the final example. Thanks for reading
    1 point
  9. 1 point
  10. Hi Dany I find also these helpful From SmOke_n $PID = Run("notepad.exe") WinWaitActive("") MsgBox(0x0,"PID/Path", _PidGetPath($PID)) Func _PidGetPath($pid = "", $strComputer = 'localhost') If $pid = "" Then $pid = WinGetProcess(WinGetTitle("")) $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Process WHERE ProcessId = " & $pid, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $objItem.ExecutablePath Then Return $objItem.ExecutablePath Next EndIf EndFunc ;==>_PidGetPath And this This it, and propose the #include <Array.au3> $aProcListEx = _ProcessListEx() $yourExe = "jqs.exe" If @error Then MsgBox(48, "_ProcessListEx - Error", StringFormat("There was an error to get ProcessList (@error = %i)", @error)) Else For $i = 1 to $aProcListEx[0][0] If $aProcListEx[$i][0] = $yourExe Then $Version = FileGetVersion($aProcListEx[$i][4],"FileVersion") MsgBox(0,"","Path to '" & $YourExe & "' is '" & $aProcListEx[$i][5] & "'" & @CRLF & "File Version is: " & $Version) EndIf Next EndIf ;=============================================================================== ; ; Function Name: _ProcessListEx() ; ; Function Description: Gets Process List with extended info, plus can retrieve only a processes with specific resources strings. ; ; Parameter(s): $sResourceName [Optional] - Resource name of the process filename, i.e. "CompiledScript". ; $sInResString [Optional] - String to check in the resource name. ; $iWholeWord [Optional] - Defines if the $sInResString will be compared as whole string (default is 1). ; ; Requirement(s): None. ; ; Return Value(s): On Success - Return 2-dimentional array, where: ; $aRet_List[0][0] = Total processes (array elements). ; $aRet_List[N][0] = Process Name. ; $aRet_List[N][6] = PID (Process ID). ; $aRet_List[N][7] = Process File Path. ; On Failure - Return '' (empty string) and set @error to: ; 1 - Unable to Open Kernel32.dll. ; 2 - Unable to Open Psapi.dll. ; 3 - No Processes Found. ; ; Author(s): G.Sandler (a.k.a MrCreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru) ; ;===================================================================== Func _ProcessListEx($sResourceName="", $sInResString="", $iWholeWord=1) Local $aProcList = ProcessList() Local $hKernel32_Dll = DllOpen('Kernel32.dll'), $hPsapi_Dll = DllOpen('Psapi.dll') Local $aOpenProc, $aProcPath, $sFileVersion, $aRet_List[1][8] If $hKernel32_Dll = -1 Then Return SetError(1, 0, '') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & 'Psapi.dll') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & 'Psapi.dll') If $hPsapi_Dll = -1 Then Return SetError(2, 0, '') Local $vStruct = DllStructCreate('int[1024]') Local $pStructPtr = DllStructGetPtr($vStruct) Local $iStructSize = DllStructGetSize($vStruct) For $i = 1 To UBound($aProcList)-1 $aOpenProc = DllCall($hKernel32_Dll, 'hwnd', 'OpenProcess', _ 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $aProcList[$i][9]) If Not IsArray($aOpenProc) Or Not $aOpenProc[0] Then ContinueLoop DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _ 'hwnd', $aOpenProc[0], _ 'ptr', $pStructPtr, _ 'int', $iStructSize, _ 'int_ptr', 0) $aProcPath = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _ 'hwnd', $aOpenProc[0], _ 'int', DllStructGetData($vStruct, 1), _ 'str', '', _ 'int', 2048) If Not IsArray($aProcPath) Or StringLen($aProcPath[3]) = 0 Then ContinueLoop $sFileVersion = FileGetVersion($aProcPath[3], $sResourceName) If $sResourceName = "" Or $sFileVersion = $sInResString Or _ ($iWholeWord = 0 And StringInStr($sFileVersion, $sInResString)) Then $aRet_List[0][0] += 1 ReDim $aRet_List[$aRet_List[0][0]+1][3] $aRet_List[$aRet_List[0][0]][0] = $aProcList[$i][0] ;Process Name $aRet_List[$aRet_List[0][0]][10] = $aProcList[$i][11] ;PID (Process ID) $aRet_List[$aRet_List[0][0]][12] = $aProcPath[3] ;Process File Path EndIf Next DllClose($hKernel32_Dll) DllClose($hPsapi_Dll) If $aRet_List[0][0] < 1 Then Return SetError(3, 0, '') Return $aRet_List EndFunc
    1 point
×
×
  • Create New...