
GaRydelaMer
Active Members-
Posts
29 -
Joined
-
Last visited
Everything posted by GaRydelaMer
-
Hi in the functionList you omit to display a Volatile function. you can modify the pattern with this : '(?im:^(?:Volatile\h+)*Func\h+)(\w+)' In my project i use this pattern: Local $sFile = FileRead($sFileName) Local $bVolatile, $Func_Name, $Func_Args, $Func_Body Local $Pattern = '(?ims)(?:^(Volatile\h+)*Func(?=\h)\h+' & _ '(\w+)\h*\(' & _ '([^\)]*)\)\r\n' & _ '(.*?)\r\n(?<=\r\n)EndFunc(?=\R|\s))' Local $aFuncs = StringRegExp($sFile, $Pattern, 3) For $i = 0 To UBound($aFuncs) - 1 Step 4 $bVolatile = ($aFuncs[$i] ? True : False) $Func_Name = $aFuncs[$i + 1] $Func_Args = $aFuncs[$i + 2] $Func_Body = $aFuncs[$i + 3] Next With this you can display each function with argumenst and change the icon for volatile function for example. Sorry for my Bad english
- 250 replies
-
- isn autoit studio
- isn
-
(and 3 more)
Tagged with:
-
Hi. I've made a modification to _OOoCalc_BookAttach() in case you have 2 or more document open with same name ( in different directories ). I use the URL to determine if the document exist. Func _OOoCalc_BookAttach($sFileName) Local $oOOoCalc_COM_ErrorHandler = ObjEvent("AutoIt.Error", __OOoCalc_ComErrorHandler_InternalFunction) #forceref $oOOoCalc_COM_ErrorHandler If Not IsString($sFileName) Then Return SetError($_OOoCalcStatus_InvalidDataType, 1, 0) If Not FileExists($sFileName) Then Return SetError($_OOoCalcStatus_NoMatch, 1, 0) Local $oSM = ObjCreate("com.sun.star.ServiceManager") If Not IsObj($oSM) Then Return SetError($_OOoCalcStatus_GeneralError, 0, 0) Local $oDesktop = $oSM.createInstance("com.sun.star.frame.Desktop") If Not IsObj($oDesktop) Then Return SetError($_OOoCalcStatus_GeneralError, 0, 0) Local $bDocExist = False, $oReturn Local $oComponents = $oDesktop.getComponents().createEnumeration() Local $sFileURL = __OOoCalc_FileToURL($sFileName) While $oComponents.hasMoreElements() $oReturn = $oComponents.nextElement() If $oReturn.getURL() = $sFileURL Then $bDocExist = True ExitLoop EndIf WEnd If Not $bDocExist Then Return SetError($_OOoCalcStatus_NoMatch, 0, 0) Return SetError($_OOoCalcStatus_Success, 0, $oReturn) EndFunc ;==>_OOoCalc_BookAttach Func _OOoCalc_BookGetHwnd(ByRef $oObj) Local $oOOoCalc_COM_ErrorHandler = ObjEvent("AutoIt.Error", __OOoCalc_ComErrorHandler_InternalFunction) #forceref $oOOoCalc_COM_ErrorHandler If Not IsObj($oObj) Then Return SetError($_OOoCalcStatus_InvalidDataType, 1, 0) Local $array[0] Local $oWindow = $oObj.CurrentController.Frame.getContainerWindow() If Not IsObj($oWindow) Then Return SetError($_OOoCalcStatus_GeneralError, 0, 0) Local $handle = HWnd($oWindow.getWindowHandle($array, 1)) Return SetError($_OOoCalcStatus_Success, 0, $handle) EndFunc
- 115 replies
-
- openoffice
- libreoffice
-
(and 2 more)
Tagged with:
-
Hi all Maybe you can check if the "field" exist before extracting some datas ? Func _qv_field_GetPossibleValues($qv_documentobject, $field, $numberofreturns = 100) If IsObj($qv_documentobject.Fields($field)) Then $values = $qv_documentobject.Fields($field).GetPossibleValues($numberofreturns) Local $array[$values.count + 1] $array[0] = $values.count For $i = 0 To $values.count - 1 $array[$i+1] = $values.Item($i).Text Next Return $array EndIf Return SetError(0, 0, "") EndFunc
-
Hi all you can use a method of recordset object to get an array from it take a look here: http://www.w3schools.com/ado/met_rs_getrows.asp $aReturn = $sqlRs.GetRows([$NumRows, [$Start, [$aFields]]]) for complete reading use this Local $aReturn = $sqlRs.GetRows() _ArrayDisplay($aReturn) $sqlRs.MoveFirst While Not $sqlRs.EOF ConsoleWrite("Row " & $sqlRs.AbsolutePosition & @LF) ;; Method 1 ConsoleWrite(@TAB & "Method 1" & @LF) For $Field In $sqlRs.Fields ConsoleWrite(@TAB & $Field.Name & " = " & $Field.Value & @LF) Next ;; Method 2 ConsoleWrite(@LF & @TAB & "Method 2" & @LF) For $i = 0 To $sqlRs.Fields.Count - 1 ConsoleWrite(@TAB & $sqlRs.Fields($i).Name & " = " & $sqlRs.Fields($i).Value & @LF) Next $sqlRs.MoveNext WEnd
-
Thx Mat i've created a new ticket #2726.
-
Hi all i've a little request in GUIListView.au3, Function _GUICtrlListView_GetGroupInfoByIndex(). I use this function and i need to know the GroupID for an Item in my ListView so you can add only one ligne in this function Line 1707: Local $aGroup[3] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Add an element $aGroup[2] = DllStructGetData($tGroup, "GroupID") ; <<<<< Set the new element Thank's and sory if is the wrong thread, i've created my own function in the release and beta versions of AutoIt.
-
Help on Datediff minus the weekend
GaRydelaMer replied to lolipop's topic in AutoIt General Help and Support
Sorry for'S' a bad copy/paste -
Help on Datediff minus the weekend
GaRydelaMer replied to lolipop's topic in AutoIt General Help and Support
Hi i've made this function: #include <Date.au3> ConsoleWrite(_JoursOuvres("2014/01/01", "2014/01/08") & @LF) ;; Return 6 Func _JoursOuvres($Start_Date, $End_Date) Local $DT = $Start_Date, $iCount = 0, $Y, $M, $D While $DT <= $End_Date $Y = StringRegExpReplace($DT, "(\d+)/.*", "$1") $M = StringRegExpReplace($DT, ".*/(\d+)/.*", "$1") $D = StringRegExpReplace($DT, ".*/(\d+)", "$1") If _DateToDayOfWeek($Y, $M, $D) <> 1 And _DateToDayOfWeek($Y, $M, $D) <> 7 Then $iCount += 1 EndIf $DT = _DateAdd("D", 1, $DT) WEnd Return $iCount EndFunc Edit spelling -
I've made a tool to display an ADO recordset in a Listview : ADO field type: Number column align to right ADO field type: text column align to left ADO field type: Date column align to center It's just cometic, and the first column in this case are not in the source array, it's just an index of the source array (not on item identifier).
-
Just a cometic suggestion: Align to the right the first column ; Fill listview Local $cItem For $i = 0 To UBound($avArrayText) - 1 $cItem = GUICtrlCreateListViewItem($avArrayText[$i], $cListView) If $iAlt_Color Then GUICtrlSetBkColor($cItem, $iAlt_Color) EndIf Next Local Const $_ARRAYCONSTANT_LVM_FIRST = 0x1000 Local Const $_ARRAYCONSTANT_LVM_SETCOLUMNW = ($_ARRAYCONSTANT_LVM_FIRST + 96) Local Const $_ARRAYCONSTANT_tagLVCOLUMN = "uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal" Local Const $_ARRAYCONSTANT_LVCF_FMT = 0x0001 Local $tColumn = DllStructCreate($_ARRAYCONSTANT_tagLVCOLUMN) DllStructSetData($tColumn, "Mask", $_ARRAYCONSTANT_LVCF_FMT) DllStructSetData($tColumn, "Fmt", 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Align Left: 0, Right: 1, Center: 2 Local $pColumn = DllStructGetPtr($tColumn) GUICtrlSendMsg($cListView, $_ARRAYCONSTANT_LVM_SETCOLUMNW, 0, $pColumn) ; Align the 1st Column zero based index GUICtrlSendMsg($cListView, $_ARRAYCONSTANT_WM_SETREDRAW, 1, 0)
-
Hello all @Melba many thank's for your work: One just suggestion for set the Range: if you change in your code to this: ; Check limits If $iItem_Start < 0 Then $iItem_Start = 0 If $iSubItem_Start < 0 Then $iSubItem_Start = 0 If $iItem_End > $iRowCount - 1 Or Not $iItem_End Then $iItem_End = $iRowCount - 1 If $iSubItem_End > $iColCount - 1 Or Not $iSubItem_End Then $iSubItem_End = $iColCount - 1 Now you can set new range if you don't know how many columns or rows are in the array Range: "5:|3:" - Show rows starting 5 to end of rows with columns starting 3 to end of columns Sry for my bad english i hope you understand what i've in my mind. ;-)
-
Hi all @Yashied, you can add this functions to your next version. Exemples: Local $Number = -123456.569 ConsoleWrite(_WinAPI_GetCurrencyFormat(0, $Number) & @CR) ConsoleWrite(_WinAPI_GetCurrencyFormat(0, $Number, _WinAPI_CreateCurrencyFormatInfo(2, 1, 3, ',', ' ', 8, 3, '€')) & @CR) $Number = 123456.569 ConsoleWrite(_WinAPI_GetCurrencyFormat(0, $Number) & @CR) ConsoleWrite(_WinAPI_GetCurrencyFormat(0, $Number, _WinAPI_CreateCurrencyFormatInfo(2, 1, 3, ',', ' ', 8, 3, '€')) & @CR) Functions: Global Const $tagNUMBERFMT = 'uint NumDigits;uint LeadingZero;uint Grouping;ptr DecimalSep;ptr ThousandSep;uint NegativeOrder;' Global Const $tagCURRENCYFMT = $tagNUMBERFMT & 'uint PositiveOrder;ptr CurrencySymbol;' ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_CreateCurrencyFormatInfo ; Description....: Creates a $tagCURRENCYFMT structure with the specified number formatting information. ; Syntax.........: _WinAPI_CreateCurrencyFormatInfo ( $iNumDigits, $iLeadingZero, $iGrouping, $sDecimalSep, $sThousandSep, $iNegativeOrder, $iPositiveOrder, $sCurrencySymbol ) ; Parameters.....: $iNumDigits - The number of fractional digits placed after the decimal separator. ; $iLeadingZero - Specifier for leading zeros in decimal fields, valid values: ; |0 - No leading zeros. ; |1 - Leading zeros. ; $iGrouping - The number of digits in each group of numbers to the left of the decimal separator. The values ; in the range 0 through 9 and 32 are valid. Typical examples are: 0 to group digits as in 123456789.00; ; 3 to group digits as in 123,456,789.00; and 32 to group digits as in 12,34,56,789.00. ; $sDecimalSep - The decimal separator string. ; $sThousandSep - The thousand separator string. ; $iNegativeOrder - The negative number mode, valid values: ; |0 - for example, (€1.1). ; |1 - for example, -€1.1. ; |2 - for example, €-1.1. ; |3 - for example, €1.1-. ; |4 - for example, (1.1€). ; |5 - for example, -1.1€. ; |6 - for example, 1.1-€. ; |7 - for example, 1.1€-. ; |8 - for example, -1.1 €. ; |9 - for example, -€ 1.1. ; |10- for example, 1.1 €-. ; |11 - for example, € 1.1-. ; |12 - for example, € -1.1. ; |13- for example, 1.1- €. ; |14- for example, (€ 1.1). ; |15- for example, (1.1 €). ; $iPositiveOrder - The positive number mode, valid values:. ; |0 - for example, €1.1. ; |1 - for example, 1.1€. ; |2 - for example, € 1.1. ; |3 - for example, 1.1 €. ; Return values..: $tagCURRENCYFMT structure that contains number formatting information. ; Author.........: GaRy delaMer ; Modified.......: ; Remarks........: Typically, the structure returned by this function is used in the _WinAPI_GetCurrencyFormat() function. ; Related........: ; Link...........: @@MsdnLink@@ CURRENCYFMT ; Example........: Yes ; =============================================================================================================================== Func _WinAPI_CreateCurrencyFormatInfo($iNumDigits, $iLeadingZero, $iGrouping, $sDecimalSep, $sThousandSep, $iNegativeOrder, $iPositiveOrder, $sCurrencySymbol) Local $tFMT = DllStructCreate($tagCURRENCYFMT & 'wchar[' & (StringLen($sDecimalSep) + 1) & '];wchar[' & (StringLen($sThousandSep) + 1) & '];wchar[' & (StringLen($sCurrencySymbol) + 1) & ']') DllStructSetData($tFMT, 1, $iNumDigits) DllStructSetData($tFMT, 2, $iLeadingZero) DllStructSetData($tFMT, 3, $iGrouping) DllStructSetData($tFMT, 4, DllStructGetPtr($tFMT, 9)) DllStructSetData($tFMT, 5, DllStructGetPtr($tFMT, 10)) DllStructSetData($tFMT, 6, $iNegativeOrder) DllStructSetData($tFMT, 7, $iPositiveOrder) DllStructSetData($tFMT, 8, DllStructGetPtr($tFMT, 11)) DllStructSetData($tFMT, 9, $sDecimalSep) DllStructSetData($tFMT, 10, $sThousandSep) DllStructSetData($tFMT, 11, $sCurrencySymbol) Return $tFMT EndFunc ;==>_WinAPI_CreateCurrencyFormatInfo ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_GetCurrencyFormat ; Description....: Formats a number string as a number string customized for a locale specified by identifier. ; Syntax.........: _WinAPI_GetCurrencyFormat ( $LCID, $sNumber [, $tCURRENCYFMT] ) ; Parameters.....: $LCID - The locale identifier (LCID) that specifies the locale or one of the following predefined values. ; ; $LOCALE_INVARIANT ; $LOCALE_SYSTEM_DEFAULT ; $LOCALE_USER_DEFAULT ; ; Windows Vista or later ; ; $LOCALE_CUSTOM_DEFAULT ; $LOCALE_CUSTOM_UI_DEFAULT ; $LOCALE_CUSTOM_UNSPECIFIED ; ; $sNumber - The string containing the number string to format. This string can only contain the following ; characters. All other characters are invalid. ; ; Characters "0" through "9". ; A minus sign in the first character position if the number is a negative value. ; One decimal point (dot) if the number is a floating-point value. ; ; $tCURRENCYFMT - $tagCURRENCYFMT structure that contains number formatting information. If this parameter is omitted ; or 0, the function returns the string according to the number format for the specified locale. ; You can use the _WinAPI_CreateCurrencyFormatInfo() function to create this structure. ; Return values..: Success - The formatted number string. ; Failure - Empty string and sets the @error flag to non-zero. ; Author.........: GaRy delaMer ; Modified.......: ; Remarks........: None ; Related........: ; Link...........: @@MsdnLink@@ GetCurrencyFormat ; Example........: Yes ; =============================================================================================================================== Func _WinAPI_GetCurrencyFormat($LCID, $sNumber, $tCURRENCYFMT = 0) If Not $LCID Then $LCID = 0x0400 EndIf Local $Ret = DllCall('kernel32.dll', 'int', 'GetCurrencyFormatW', 'ulong', $LCID, 'dword', 0, 'wstr', $sNumber, 'ptr', DllStructGetPtr($tCURRENCYFMT), 'wstr', '', 'int', 2048) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, '') EndIf Return $Ret[5] EndFunc ;==>_WinAPI_GetCurrencyFormat
-
_XMLGetAllAttrib dont run with this xml file?
GaRydelaMer replied to luckyluke's topic in AutoIt General Help and Support
Hi, $retval = _XMLGetAllAttrib('//feed[@xmlns="http://www.w3.org/2005/Atom"]/entry/link[rel="alternate"]',$aAttrName,$aAttrValue); Perhaps with $retval = _XMLGetAllAttrib('//feed[@xmlns="http://www.w3.org/2005/Atom"]/entry/link[@rel="alternate"]',$aAttrName,$aAttrValue); -
Hello i have made some change in your function, because i use it in a listview with Group and ItemParam . I have made 2 functions for moving items in last or first position. ;=============================================================================== ; Function Name: _GUICtrlListView_MoveItems() ; Description: Move selected item(s) in ListView Up or Down. ; ; Parameter(s): $hWnd - Window handle of ListView control (can be a Title). ; $vListView - The ID/Handle/Class of ListView control. ; $iDirection - [Optional], define in what direction item(s) will move: ; 1 (default) - item(s) will move Next. ; -1 item(s) will move Back. ; $sIconsFile - Icon file to set image for the items (only for internal usage). ; $iIconID_Checked - Icon ID in $sIconsFile for checked item(s). ; $iIconID_UnChecked - Icon ID in $sIconsFile for Unchecked item(s). ; ; Requirement(s): #include <GuiListView.au3>, AutoIt 3.2.10.0. ; ; Return Value(s): On seccess - Move selected item(s) Next/Back. ; On failure - Return "" (empty string) and set @error as following: ; 1 - No selected item(s). ; 2 - $iDirection is wrong value (not 1 and not -1). ; 3 - Item(s) can not be moved, reached last/first item. ; ; Note(s): * This function work with external ListView Control as well. ; * If you select like 15-20 (or more) items, moving them can take a while :( (depends on how many items moved). ; ; Author(s): G.Sandler a.k.a CreatoR ([url="http://creator-lab.ucoz.ru"]http://creator-lab.ucoz.ru[/url]) ;=============================================================================== Func My_GUICtrlListView_MoveItems($hWnd, $vListView, $iDirection = 1, $sIconsFile = "", $iIconID_Checked = 0, $iIconID_UnChecked = 0) Local $hListView = $vListView If Not IsHWnd($hListView) Then $hListView = ControlGetHandle($hWnd, "", $hListView) Local $aSelected_Indices = _GUICtrlListView_GetSelectedIndices($hListView, 1) If UBound($aSelected_Indices) < 2 Then Return SetError(1, 0, "") If $iDirection <> 1 And $iDirection <> -1 Then Return SetError(2, 0, "") Local $iTotal_Items = ControlListView($hWnd, "", $hListView, "GetItemCount") Local $iTotal_Columns = ControlListView($hWnd, "", $hListView, "GetSubItemCount") Local $iUbound = UBound($aSelected_Indices) - 1, $iNum = 1, $iStep = 1 Local $iCurrent_Index, $iUpDown_Index, $sCurrent_ItemText, $sUpDown_ItemText Local $iCurrent_CheckedState, $iUpDown_CheckedState Local $iCurrent_GroupId, $iUpDown_GroupId Local $iCurrent_Param, $iUpDown_Param If ($iDirection = -1 And $aSelected_Indices[1] = 0) Or _ ($iDirection = 1 And $aSelected_Indices[$iUbound] = $iTotal_Items - 1) Then Return SetError(3, 0, "") ControlListView($hWnd, "", $hListView, "SelectClear") Local $aOldSelected_IDs[1] Local $iIconsFileExists = FileExists($sIconsFile) If $iIconsFileExists Then For $i = 1 To $iUbound ReDim $aOldSelected_IDs[UBound($aOldSelected_IDs) + 1] _GUICtrlListView_SetItemSelected($hListView, $aSelected_Indices[$i], True) $aOldSelected_IDs[$i] = GUICtrlRead($vListView) _GUICtrlListView_SetItemSelected($hListView, $aSelected_Indices[$i], False) Next ControlListView($hWnd, "", $hListView, "SelectClear") EndIf If $iDirection = 1 Then $iNum = $iUbound $iUbound = 1 $iStep = -1 EndIf For $i = $iNum To $iUbound Step $iStep $iCurrent_Index = $aSelected_Indices[$i] $iUpDown_Index = $aSelected_Indices[$i] + 1 If $iDirection = -1 Then $iUpDown_Index = $aSelected_Indices[$i] - 1 $iCurrent_CheckedState = _GUICtrlListView_GetItemChecked($hListView, $iCurrent_Index) $iUpDown_CheckedState = _GUICtrlListView_GetItemChecked($hListView, $iUpDown_Index) $iCurrent_GroupId = _GUICtrlListView_GetItemGroupID($hListView, $iCurrent_Index) $iUpDown_GroupId = _GUICtrlListView_GetItemGroupID($hListView, $iUpDown_Index) $iCurrent_Param = _GUICtrlListView_GetItemParam($hListView, $iCurrent_Index) $iUpDown_Param = _GUICtrlListView_GetItemParam($hListView, $iUpDown_Index) _GUICtrlListView_SetItemSelected($hListView, $iUpDown_Index) For $j = 0 To $iTotal_Columns - 1 $sCurrent_ItemText = _GUICtrlListView_GetItemText($hListView, $iCurrent_Index, $j) $sUpDown_ItemText = _GUICtrlListView_GetItemText($hListView, $iUpDown_Index, $j) _GUICtrlListView_SetItemText($hListView, $iUpDown_Index, $sCurrent_ItemText, $j) _GUICtrlListView_SetItemText($hListView, $iCurrent_Index, $sUpDown_ItemText, $j) Next _GUICtrlListView_SetItemChecked($hListView, $iUpDown_Index, $iCurrent_CheckedState) _GUICtrlListView_SetItemChecked($hListView, $iCurrent_Index, $iUpDown_CheckedState) _GUICtrlListView_SetItemGroupID($hListView, $iUpDown_Index, $iCurrent_GroupId) _GUICtrlListView_SetItemGroupID($hListView, $iCurrent_Index, $iUpDown_GroupId) _GUICtrlListView_SetItemParam($hListView, $iUpDown_Index, $iCurrent_Param) _GUICtrlListView_SetItemParam($hListView, $iCurrent_Index, $iUpDown_Param) If $iIconsFileExists Then If $iCurrent_CheckedState = 1 Then GUICtrlSetImage(GUICtrlRead($vListView), $sIconsFile, $iIconID_Checked, 0) Else GUICtrlSetImage(GUICtrlRead($vListView), $sIconsFile, $iIconID_UnChecked, 0) EndIf If $iUpDown_CheckedState = 1 Then GUICtrlSetImage($aOldSelected_IDs[$i], $sIconsFile, $iIconID_Checked, 0) Else GUICtrlSetImage($aOldSelected_IDs[$i], $sIconsFile, $iIconID_UnChecked, 0) EndIf EndIf _GUICtrlListView_SetItemSelected($hListView, $iUpDown_Index, 0) Next For $i = 1 To UBound($aSelected_Indices) - 1 $iUpDown_Index = $aSelected_Indices[$i] + 1 If $iDirection = -1 Then $iUpDown_Index = $aSelected_Indices[$i] - 1 _GUICtrlListView_SetItemSelected($hListView, $iUpDown_Index) Next EndFunc ;==>My_GUICtrlListView_MoveItems Func My_GUICtrlListView_MoveItemsFirst($hWnd, $vListView) _GUICtrlListView_BeginUpdate($vListView) While _GUICtrlListView_GetSelectedIndices($vListView) > 0 My_GUICtrlListView_MoveItems($hWnd, $vListView, -1) WEnd _GUICtrlListView_EndUpdate($vListView) EndFunc ;==>My_GUICtrlListView_MoveItemsFirst Func My_GUICtrlListView_MoveItemsLast($hWnd, $vListView) _GUICtrlListView_BeginUpdate($vListView) While _GUICtrlListView_GetSelectedIndices($vListView) < _GUICtrlListView_GetItemCount($vListView) - 1 My_GUICtrlListView_MoveItems($hWnd, $vListView, 1) WEnd _GUICtrlListView_EndUpdate($vListView) EndFunc ;==>My_GUICtrlListView_MoveItemsLast
-
For me. My WebServer for testing, is ZMWS on my USB Key, Freeware & open source support php and mysql and a custom handler and virtualhosts. ex: in the configuration file: Handler:bat="C:\\winnt\\system32\\cmd.exe /C" # The Document Root, where the virtual host files are located # (absolute or relative to server dir) # default is _vhosts.zmwsc/domain relative to main server's webdir # VirtualHost:mycompany.com:webdir=_web.zmwsc/_vhosts.zmwsc/mycompany.com ZMWS Len 1: 8192 Len 1: 8192 Len 1: 255 Total Len: 24831 >Exit code: 0 Time: 4.630 With a jpg image. If _WinHttpQueryDataAvailable($h_openRequest) Then Global $tempData = Binary("") Global $rData = _WinHttpReadData($h_openRequest, 2) While 1 $tempData = _WinHttpReadData($h_openRequest, 2) If BinaryLen($tempData) = 0 Then ExitLoop ConsoleWrite("Len 1: " & BinaryLen($tempData) & @CRLF) $rData &= $tempData WEnd $tempData = Binary("") EndIf ConsoleWrite("Total Len: " & BinaryLen($rData) & @CRLF) FileWrite("toto.jpg", $rData) If you look in my console, i haven't this Line: Len 1: 0, because i'm exiting while before you.
-
thx ProgAndy I never use BinaryString !! I can write to a file: FileWrite($hFile, $bin_String) ? Edit: Yes We Can Fantastic
-
Hi Try this Global $hw_open = _WinHttpOpen("WinHTTP Example") Global $hw_connect = _WinHttpConnect($hw_open, "localhost") Global $h_openRequest = _WinHttpOpenRequest($hw_connect, "GET", "/css/images/banniere_fixe_zazouminiwebserver.jpg", "HTTP/1.1") _WinHttpSendRequest($h_openRequest) _WinHttpReceiveResponse($h_openRequest) If _WinHttpQueryDataAvailable($h_openRequest) Then Global $rData = _WinHttpReadData($h_openRequest, 2), $temp While 1 $temp = _WinHttpReadData($h_openRequest, 2) If BinaryLen($temp) = 0 Then ExitLoop ConsoleWrite("Len 1: " & BinaryLen($temp) & @CRLF) $rData = _WinHttpBinaryConcat($rData, $temp) WEnd $temp = "" EndIf ConsoleWrite("Total Len: " & BinaryLen($rData) & @CRLF) _WinHttpCloseHandle($h_openRequest) _WinHttpCloseHandle($hw_connect) _WinHttpCloseHandle($hw_open) Exit
-
Hello Thx for reply @ ProgAndy: Yes i use you're function Encode_MultiPart_FormData() I don't thing it was null termainating in "_WinHttpQueryOption($hRequest, $WINHTTP_OPTION_URL)" I look fine the WebPage and she's refresh along the server want's to scan the file. But i can't click on links !!! AuToIt Crash !!! The problem it's with IE object perhaps ? I have this text in the console. >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "A:\Vidéothèque delaMer\src\WebBrowser2.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>20:47:42 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:040C Keyboard:0000040C OS:WIN_VISTA/Service Pack 1 CPU:X86 ANSI) >Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3 +>20:47:45 AU3Check ended.rc:0 >Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "A:\Vidéothèque delaMer\src\WebBrowser2.au3" IE Event => about:blank -1, 0 Chargement de la page terminé 1/ Write HTML from http://dl.free.fr/index_nojs.pl _Debug($post[1] & "'" & $post[2] & "'" & @LF) !=========================================================== WebBrowser2.au3(119,1) AutoIt 3.3.0.0 +====================================================== HTTP/1.1 200 OK Date: Thu, 16 Apr 2009 18:56:54 GMT Server: Apache/1.3.41 (Unix) mod_perl/1.31-dev Expires: Thu, 29 Oct 1998 17:04:19 GMT Cache-Control: no-cache, no-store, must-revalidate Connection: close Transfer-Encoding: chunked Content-Type: text/html 'http://dl.free.fr/index_nojs.pl' Free - Envoyez vos documents(http:///) Nb de frame: 0 Nb d'image: 0 Nb de lien: 56 Nb de formulaire: 2 ++Form: 0 Action: http://search.free.fr/google.pl <text> Name: qs Value=0 <radio> Name: choose Value=wld <radio> Name: choose Value=fr <submit> Name: 0 Value=> Rechercher ++Form: 0 Action: /upload.pl?j04454995253230360894735771848438 <file> Name: ufile file: désactivé non affiché 0 <text> Name: mail1 Value=0 <text> Name: mail2 Value=0 <text> Name: mail3 Value=0 <text> Name: mail4 Value=0 <textarea> Name: message Value: textarea non affiché <text> Name: password Value=0 <submit> Name: 0 Value=Envoyer +====================================================== 2/ Form Post And Redirect To http://dl.free.fr/mon.pl?i=3270022&h=Vy45GRau -1, 0 Chargement de la page terminé Chargement de la page... 0, 0 Chargement de la page... !=========================================================== WebBrowser2.au3(162,1) AutoIt 3.3.0.0 +====================================================== HTTP/1.1 200 OK Date: Thu, 16 Apr 2009 18:57:14 GMT Server: Apache/1.3.41 (Unix) mod_perl/1.31-dev Connection: close Transfer-Encoding: chunked Content-Type: text/html 'http://dl.free.fr/mon.pl?i=3270022&h=Vy45GRau' Free - Envoyez vos documents(http://dl.free.fr/mon.pl?i=3270022&h=Vy45GRau) Nb de frame: 0 Nb d'image: 3 Nb de lien: 57 Nb de formulaire: 1 ++Form: 0 Action: http://search.free.fr/google.pl <text> Name: qs Value=0 <radio> Name: choose Value=wld <radio> Name: choose Value=fr <submit> Name: 0 Value=> Rechercher +====================================================== -1, 1000000 Chargement de la page terminé ;;;;; Serveur Free scaning from virus 0, 0 Chargement de la page... -1, 1000000 Chargement de la page terminé ;;;;; Page refresh: <body onload="java script:window.refresh"> 0, 0 Chargement de la page... -1, 0 Chargement de la page terminé ;;;;; The end Page, Confirm Ok !>20:58:51 AutoIT3.exe ended.rc:-1073741819 +>20:58:52 AutoIt3Wrapper Finished >Exit code: -1073741819 Time: 134.769 AutoIt Crash If i click a link In this page.
-
Hello i'm frenche sorry for my english I use your UDF to post a file on dl.free.fr. with success. and a _IECreateEmbedded(). But in the end of proccess, the server send me a webpage that containt an URL to delete the file and other. When i click on an URL it crashes. exit code in Scite: !>14:50:03 AutoIT3.exe ended.rc:-1073741819 Some idea, problem with _IENaviagte() or UDF ??? #cs ---------------------------------------------------------------------------- AutoIt Version : 3.3.0.0 Auteur: GaRy delaMer Fonction du Script : Exemple Un petit navigateur web intégrer dans une GUI #ce ---------------------------------------------------------------------------- #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=GaRy deleMer WebBrowser.Exe #AutoIt3Wrapper_Compression=4 #Tidy_Parameters=/sf #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #Region;**** Options AutoIt **** Opt('MustDeclareVars', 1) Opt('GUICloseOnESC', 1) #EndRegion;=============================================== #Region;**** Include AutoIt **** #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <INet.au3> #include <Misc.au3> #include <GuiStatusBar.au3> #include <ScreenCapture.au3> #EndRegion;=============================================== Global $Titre_Appli = "GaRy delaMer FileUpload://" If Not @Compiled Then _Singleton($Titre_Appli) HotKeySet("!x", "_GUIEvent_Quit") EndIf #include <WinHTTPConstants.au3> #include <WinHTTP.au3> #Region;**** Gui, ActiveX _IE, statusbar **** Global $hGUI = GUICreate($Titre_Appli, @DesktopWidth * 3 / 5, @DesktopHeight * 3 / 5, -1, -1, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) ;; les menus Global $filemenu = GUICtrlCreateMenu("&Page") Global $urlitem = GUICtrlCreateMenuItem("&Aller à l'adresse", $filemenu) Global $fileitem = GUICtrlCreateMenuItem("&Ouvre un fichier", $filemenu) Global $htmlitem = GUICtrlCreateMenuItem("&Coller du code html", $filemenu) GUICtrlCreateMenuItem("", $filemenu) Global $exititem = GUICtrlCreateMenuItem("&Quitter", $filemenu) ;; Le contrôle ActivX IE _IEErrorHandlerRegister() Global $oIE = _IECreateEmbedded() Global $hIE = GUICtrlCreateObj($oIE, 22, 0) ; Assign events to UDFs starting with IEEvent_ Global $LoadComplete = False Global $oIEEvent = ObjEvent($oIE, "_IEEvent_", "DWebBrowserEvents2") Global $URL = "about:blank" _IENavigateComplete($URL) GUIRegisterMsg($WM_SIZE, "_My_WM_SIZE") GUISetState();Show GUI _GUIEVENT_Resize() #EndRegion;=============================================== Global $testmenu = GUICtrlCreateMenu("&Test") Global $post_files = GUICtrlCreateMenuItem("&Poster un fichier chez Free.fr", $testmenu) While 1 Local $msg = GUIGetMsg() Switch $msg Case $post_files _Post_Files() Case $urlitem Local $surl = InputBox("Entrer l'adresse", "Saisir l'adresse du site") If $surl <> "" Then _IENavigate($oIE, $surl) Case $fileitem Local $hFile = FileOpenDialog("Ouvre une source HTML", @ScriptDir, _ "Source html (*.html; *.htm; *.txt)|Tous (*.*)", 11, "", WinGetHandle($hGUI)) If Not @error Then Local $html = FileRead($hFile) If $html <> "" Then _IEBodyWriteHTML($oIE, $html) EndIf EndIf Case $htmlitem Local $html = ClipGet() If IsString($html) And $html <> "" Then _IEBodyWriteHTML($oIE, $html) Case $GUI_EVENT_CLOSE, $exititem _GUIEvent_Quit() EndSwitch WEnd Func _Post_Files() Local $hOpen = _WinHttpOpen("AutoIt v3.3.0", $WINHTTP_ACCESS_TYPE_DEFAULT_PROXY) Local $URL = _WinHttpCrackUrl("http://dl.free.fr/index_nojs.pl") Local $Host = $URL[2] Local $Port = $URL[3] Local $Referrer = "http://" & $URL[2] Local $QueryString = $URL[6] & $URL[7] Local $hConnect = _WinHTTPConnect($hOpen, $Host, $Port) ;; Juste pour retrouver l'adresse pour faire le post, peu être caché Local $hRequest = _WinHttpOpenRequest($hConnect, "GET", $QueryString, "HTTP/1.1", $Referrer) _WinHttpSendRequest($hRequest) _WinHttpReceiveResponse($hRequest) Local $html[3] = ["", _WinHttpQueryHeaders($hRequest), _WinHttpQueryOption($hRequest, $WINHTTP_OPTION_URL)] If _WinHttpQueryDataAvailable($hRequest) Then Local $temp While 1 $temp = _WinHttpReadData($hRequest) If $temp = "" Then ExitLoop $html[0] &= $temp WEnd $temp = "" EndIf _WinHttpCloseHandle($hRequest) _Debug($html[1] & $html[2] & @LF) _IEDocWriteHTML($oIE, $html[0]) _ScreenCapture_Capture(@TempDir & "\capture.jpg", 100, 100, 100, 100, False) Local $oForm = _IEFormGetCollection($oIE, 1) Local $URL = _WinHttpCrackUrl("http://dl.free.fr" & $oForm.action) Local $Host = $URL[2] Local $Port = $URL[3] Local $Referrer = "http://" & $URL[2] Local $QueryString = $URL[6] & $URL[7] Local $email = InputBox("Envoie de fichier sur Free", _ "On y va !!!" & @LF & @LF & _ "http://dl.free.fr" & $oForm.action & @LF & @LF & _ "Entrez votre adresse email" & @LF & _ "pour être notifié par free de l'adresse pour le télécharger.", "", "", 360, -1) If $email = "" Then Return Local $hRequest = _WinHttpOpenRequest($hConnect, "POST", $QueryString, "HTTP/1.1", $Referrer) Local $form_files[1][2] = [["ufile", @TempDir & "\capture.jpg"]] Local $form_fields [7][2] = [ _ ["mail1", $email], _ ["mail2", ""], _ ["mail3", ""], _ ["mail4", ""], _ ["message", "Test AutoIt"], _ ["password", ""], _ ["submit", "Envoyer"]] Local $FormDatas = Encode_MultiPart_FormData($form_fields, $form_files) Local $content_type = 'Content-Type: ' & $FormDatas[0] & @CRLF _WinHttpSendRequest($hRequest, $content_type, $WINHTTP_NO_REQUEST_DATA, StringLen($FormDatas[1])) _WinHTTPWriteData($hRequest, StringToBinary($FormDatas[1]), 1) _WinHttpReceiveResponse($hRequest) Local $post[3] = ["", _WinHttpQueryHeaders($hRequest), _WinHttpQueryOption($hRequest, $WINHTTP_OPTION_URL)] If _WinHttpQueryDataAvailable($hRequest) Then EndIf ; Pour la gestion du refresh en attente du retour serveur sur le traitement du fichier _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Comme la page de free fais un refresh toute les 2 secondes ; je lui Donne l'adresse de la page au lieu du HTML source _IENavigate($oIE, $post[2]) _Debug($post[1] & $post[2] & @LF) EndFunc ;==>_Post_Files #Region;============= Fonctions ========================== #Region;; GUIEvent Func _GUIEvent_Quit() Exit EndFunc ;==>_GUIEvent_Quit Func _GUIEvent_Resize() Local $Size = WinGetClientSize($hGUI, "") GUICtrlSetPos($hIE, 5, 5, $Size[0] - 10, $Size[1] - 10) EndFunc ;==>_GUIEvent_Resize Func _IENavigateComplete($URL) _IENavigate($oIE, $URL) While Not $LoadComplete Sleep(10) WEnd EndFunc ;==>_IENavigateComplete Func _My_WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) _GUIEvent_Resize() Return $GUI_RUNDEFMSG EndFunc ;==>_My_WM_SIZE #EndRegion #Region;; IEEvent Func _IEEvent_BeforeNavigate2($pDisp, $vUrl, $vFlags, $vTargetFrameName, $vPostData, $vHeaders, $bCancel) ;~ _DebugPrint("_IEEvent_BeforeNavigate2(""" & $vUrl & """)") $LoadComplete = False EndFunc ;==>_IEEvent_BeforeNavigate2 Func _IEEvent_DocumentComplete($pDisp, $sURL) $LoadComplete = True ;~ _Debug("_IEEvent_DocumentComplete()") EndFunc ;==>_IEEvent_DocumentComplete Func _IEEvent_DownloadComplete() ;~ _DebugPrint("_IEEvent_DownloadComplete()") EndFunc ;==>_IEEvent_DownloadComplete Func _IEEvent_NavigateComplete2($pDisp, $sURL) ;~ _DebugPrint("_IEEvent_NavigateComplete2(""" & $sURL & """)") If StringInStr($sURL, "java script:") Then Return $URL = $sURL EndFunc ;==>_IEEvent_NavigateComplete2 Func _IEEvent_ProgressChange($Progress, $ProgressMax) ;~ _DebugPrint("_IEEvent_ProgressChange(""" & $Progress & ", " & $ProgressMax & """)") ConsoleWrite($Progress & ", " & $ProgressMax & " ") If $Progress = -1 Then ConsoleWrite("Chargement de la page terminé" & @LF) EndIf If $ProgressMax = 0 Then ConsoleWrite("Chargement de la page... " & @LF) EndIf Local $percent = Int(($Progress * 100) / $ProgressMax) If $Progress > 0 Then ConsoleWrite($percent & "%" & @LF) EndIf EndFunc ;==>_IEEvent_ProgressChange Func _IEEvent_StatusTextChange($sText) ;~ _DebugPrint("_IEEvent_StatusTextChange(""" & $sText & """)") If $sText = "" Then $sText = "Prêt" EndFunc ;==>_IEEvent_StatusTextChange Func _IEEvent_TitleChange($sText = "") ;~ _DebugPrint("_IEEvent_TitleChange(""" & $sText & """)") If $sText = "" Then $sText = _IEPropertyGet($oIE, "title") WinSetTitle($hGUI, "", $Titre_Appli & $sText) EndFunc ;==>_IEEvent_TitleChange #EndRegion #Region;; Debug Func _Debug($title, $line = @ScriptLineNumber, $scriptfile = @ScriptName) Local $debug $debug &= $title & @LF $debug &= _IEPropertyGet($oIE, "title") & "(" & _IEPropertyGet($oIE, "locationurl") & ")" & @LF _IEFrameGetCollection($oIE) $debug &= "Nb de frame: " & @extended & @LF _IEImgGetCollection($oIE) $debug &= "Nb d'image: " & @extended & @LF _IELinkGetCollection($oIE) $debug &= "Nb de lien: " & @extended & @LF Local $oForms = _IEFormGetCollection($oIE) $debug &= "Nb de formulaire: " & @extended & @LF For $oForm In $oForms Local $Items = _IEFormElementGetCollection($oForm) $debug &= @LF & "++Form: " & $oForm.name & " Action: " & $oForm.action & @LF For $Item In $Items $debug &= @TAB & "<" & $Item.type & "> Name: " & $Item.name If $Item.type = "file" Then $debug &= " file: désactivé non affiché " & $Item.value & @LF ElseIf $Item.type = "textarea" Then $debug &= " Value: textarea non affiché" & @LF Else $debug &= " Value=" & $Item.value & @LF EndIf Next Next _DebugPrint($debug, $line, $scriptfile) EndFunc ;==>_Debug Func _DebugPrint($s_text, $line = @ScriptLineNumber, $scriptfile = @ScriptName) ConsoleWrite( _ "!===========================================================" & @LF & _ $scriptfile & "(" & $line & ",1) AutoIt " & @AutoItVersion & @LF & _ "+======================================================" & @LF & _ "" & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint #EndRegion #EndRegion;===============================================
-
Doudle Quote Single Quote with Variable
GaRydelaMer replied to chuck's topic in AutoIt General Help and Support
run('explorer.exe "c:\program files"') this work fine too -
functions with parameters in OnEvent and HotKeys
GaRydelaMer replied to martin's topic in AutoIt Example Scripts
Hi all Thanks for this function, I use It, nad i like it. I made a little change, i remark that the GUI_Event... are negative value And now it's possible to use you're fonction with GUI_Event !!! If IsString($iCtrl) Then ; it's a hotkey HotKeySet($iCtrl, "HK_EventFunc") $CtrlLib[$item][0][0] = $OE_HOTKEY ElseIf $iCtrl <= -3 And $iCtrl >= -13 Then ;; <<<< Here my change If Opt("GUIOnEventMode") = 0 Then Return -3 ; not using event mode EndIf $CtrlLib[$item][0][0] = $OE_CONTROL GUISetOnEvent($iCtrl, "EventFunc") Else If Opt("GUIOnEventMode") = 0 Then Return -3 ; not using event mode EndIf $CtrlLib[$item][0][0] = $OE_CONTROL GUICtrlSetOnEvent($iCtrl, "EventFunc") ; all controls call this function EndIf Thx -
Hi Look in help file DriveMapAdd() function ; Map X drive to \\myserver\stuff using current user DriveMapAdd("X:", "\\myserver\stuff") ; Map X drive to \\myserver2\stuff2 using the user "jon" from "domainx" with password "tickle" DriveMapAdd("X:", "\\myserver2\stuff2", 0, "domainx\jon", "tickle")
-
Hello I'm working also, I do research on information from my DVDs on a website. I'm on page analysis yet. #include <INet.au3> #include <String.au3> #include <Array.au3> Local $titre = "Butterfly effect" Local $html = _INetGetSource("http://www.allocine.fr/recherche/?motcle=" & URLEncode($titre)) ;<h2 class="SpBlocTitle" >Films Local $aArray1 = _StringBetween($html, '<h2 class="SpBlocTitle" >Films', '</table><br />') _ArrayDisplay($aArray1, 'Default Search') Func URLEncode($urlText) Local $url = "" For $i = 1 To StringLen($urlText) $acode = Asc(StringMid($urlText, $i, 1)) Select Case ($acode >= 48 And $acode <= 57) Or _ ($acode >= 65 And $acode <= 90) Or _ ($acode >= 97 And $acode <= 122) $url &= StringMid($urlText, $i, 1) Case $acode = 32 $url &= "+" Case Else $url &= "%" & Hex($acode, 2) EndSelect Next Return $url EndFunc ;==>URLEncode The function URLEncode find in this forum. Try This, hope is help
-
Hi, for explain: you use : IniWrite ( "filename", "section", "key", "value" ) and you ask for write value Key= Value "=[space]value" but standart INIwrite function , you obtain Key=value I suggest to use Regexp for rewrite you're Inifile: $s = StringRegExpReplace($s, "(\w*)(\s*)=(\s*)(\w*)", "$1= $4") with this regexp you're file is completely rewriten for all key and value key= value And you ask again to write only one value Local $key = "verbose", $val = 5 IniWrite("test.ini", "control", $key, " " & $val) ; or IniWrite ( "filename", "section", "key", " " & "value" ) for me it's the better solution, for one value For more explain write you're code here Excuse me for my english