Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/29/2012 in all areas

  1. ProgAndy

    AutoItObject UDF

    The AutoItObject team is proud to announce that the first version of our AutoItObject UDF is complete and ready to use. The project page is located at [currently missing] Please, report bugs and any other issues at our [currently missing], and not here. An overview of all the functions can be found in the online documentation [currently missing] or in the offline .chm documentation file which is included with the [currently missing]. If Origo has problems providing the download, the current version will be mirrored here The UDF requires the current AutoIt version v3.3.4.0! AutoItObject 1.2.8.2.exe AutoItObject 1.2.8.2.zip Please, leave your comments and experiences here. Regards, - trancexx - ProgAndy - monoceres - Kip Our work is published under the Artistic License 2.0 A copy of the FAQ to answer your most urgent questions right away: (can also be found at the online documentation: Some helper-functions: When using the Wrapper, this are some simple methods to get a return value from the resulting array. ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOResult ; Description ...: Returns the return value of the Call to a WraperObject function ; Syntax.........: _AIOResult(Const $aResult [, $vError=0] ) ; Parameters ....: $aResult - the resulting array ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Returnvalue ($aResult[0]) ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOResult(Const $aResult, $vError=0) ; Author: Prog@ndy If IsArray($aResult) Then Return $aResult[0] Return SetError(1,0,$vError) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOParam ; Description ...: Returns the parameter value of the Call to a WraperObject function ; Syntax.........: _AIOParam(Const $aResult, $iParam, $vError=0) ; Parameters ....: $aResult - the resulting array ; $iParam - The parameterindex to return (0: result, 1: first parameter, 2: 2nd parameter, ...) ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Parameter value ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOParam(Const $aResult, $iParam, $vError=0) ; Author: Prog@ndy If UBound($aResult)-1 < $iParam Then Return SetError(1,0,$vError) Return SetExtended($aResult[0], $aResult[$iParam]) EndFunc
    1 point
  2. This is my first post here, so before comin' into detail I want to say hello to the AutoIt-community and want to thank Jon and the AutoIt-Team for their genial work with all my heart :"> While learning more and more of AutoIt I still have to recognize that my brain and my eyes find no solution for the following: My script starts IrfanView, opens the 'Save as..'-dialog and shall select the JPEG-Format (selection is done by choosing the right entry of a ComboBox). This is quite easy, but now I want to be language-independent, therefore I changed to classnames and IDs for all the windows and buttons, it's still working fine With different languages the Name of the ComoBox-Entry changes, for instance 'JPG - JPEG Files' changes to 'JPG - JPEG Dateien'. I can do a IniRead to get the choosen language and to choose the right string to be selected in the ComboBox (shall the script use the german string or the english one). Just to get better known to AutoIt and to see what's possible and to find another solution, I want to find a string-appearance in a ComboBox (not an exact string!), so it shall search for 'JPG' and give me the 'occurence' of the string which consist of 'JPG' (not only) (for the start lets assume there's only one string which has JPG inside, anywhere). $combo_jpeg = ControlCommand("classname=#32770","","ComboBox2","FindString", 'JPG - JPEG Files') ControlCommand("classname=#32770","","ComboBox2","SetCurrentSelection", $combo_jpeg) 'FindString' only gives the occurence of the string if the string is exact (as it is written in the help-file). Here are my questions: 1. am I able to get all the ComboBox-entries in an array or sth. like that ? how to get access to all the entries in a ComboBox - I want to know, what entries can be choosen (GUIread only gives to current selected entry) 2. or is there a find-stringappearance(not exact)-option ? 3. Another problem, see picture below: all IDs are working but not the ComboBox-ID - here I have to use "ComboBox2", which is still okay, but still makes me wonder ControlCommand("classname=#32770","","ComboBox2","SetCurrentSelection", $combo_jpeg) ;ControlCommand("classname=#32770","","ComboBox2","SelectString", 'JPG - JPEG Files') works fine ControlCommand("classname=#32770","",1136,"SetCurrentSelection", $combo_jpeg) ;ControlCommand("classname=#32770","",1136,"SelectString", 'JPG - JPEG Files') does not BTW sure, Opt("WinTitleMatchMode", 4) is set, AutoIt 3.0.1.03 is used
    1 point
  3. you should probably post a code snippet to the areas you want to adjust/add to. Makes it easier for someone to help. also... how the hell did you write 5k lines of code and not know what you're doing
    1 point
  4. chause4, And where is the loop to keep the script alive while waiting for the HotKey? M23
    1 point
  5. chause4, No, each function declaration must be contained within its own Func...EndFunc outside any other structure. But there is nothing to stop you doing that and calling _RandomMsg() from within _run(). M23
    1 point
  6. No, you can not have one function inside another one.
    1 point
  7. Hi, PPCC, yes MSIs are standardized to support silent installs (try msiexec /? to see a list of switches you can use). The benefit to these, as well, is the ability to set your global properties via the command line. For example, if I have an install that requires that I accept an EULA, I can do something like this: msiexec /i "<my product name>.msi" ACCEPT=YES /qn
    1 point
  8. As i understand it Send will always be interruptable by the person on the keyboard which can throw you an error if he is banging away whilst your script is running. Silent installers are always better because its not waiting for keystrokes I wouldnt say msi is the best for silent ive automated lots of different types and they all work in different ways
    1 point
  9. Hi, PPCC. Not bad, but using Send you're just begging for something to go wrong. All of the desktop support guys where I used to work used AutoIt, so I simply used Wix to package both AutoIT and the latest full version of SciTe as a single MSI. Makes it very easy to install manually. The same could be said for most any other app
    1 point
  10. water

    _ArrayDisplay question

    I was writing the post from my mobile phone and wasn't sure if the name was exactly what I posted. Therefore: or so - means: or something like that :-)
    1 point
  11. eukalyptus

    GDI and sprites

    Try this: #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $hBmp_Background = _WinAPI_LoadImage(0, @ScriptDir & "\Kaffeetasse.bmp", $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE) Global $aMario[3] $aMario[0] = _LoadSprite(@ScriptDir & "\Mario1.bmp") $aMario[1] = _LoadSprite(@ScriptDir & "\Mario2.bmp") $aMario[2] = _LoadSprite(@ScriptDir & "\Mario3.bmp") Global $hGui = GUICreate("", 320, 240) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $hDC = _WinAPI_GetDC($hGui) Global $hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC) Global $hBmp_Buffer = _WinAPI_CreateCompatibleBitmap($hDC, 320, 240) _WinAPI_SelectObject($hDC_Buffer, $hBmp_Buffer) Global $hDC_Draw = _WinAPI_CreateCompatibleDC($hDC) GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "WM_PAINT") GUISetState() _Draw() _DrawSprite($hDC_Buffer, $aMario[0], 0, 0, 10) _WinAPI_BitBlt($hDC, 0, 0, 320, 240, $hDC_Buffer, 0, 0, $SRCCOPY) MsgBox(0, "note", "Sprite has transparent pixels! although it was loaded from a normal BMP-file") While Sleep(40) _Draw() WEnd Func _DrawSprite($hDC, $aSprite, $iX, $iY, $fScale = 1) If UBound($aSprite) <> 3 Then Return SetError(1, 1, False) Return _WinAPI_DrawIconEx($hDC, $iX, $iY, $aSprite[0], $aSprite[1] * $fScale, $aSprite[2] * $fScale) EndFunc ;==>_DrawSprite Func _LoadSprite($sFilename) Local $hBMP = _WinAPI_LoadImage(0, $sFilename, $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE) If @error Or Not $hBMP Then Return SetError(1, 1, False) Local $tBitmap = DllStructCreate("long bmType; long bmWidth; long bmHeight; long bmWidthBytes; ushort bmPlanes; ushort bmBitsPixel; ptr bmBits;") Local $aResult = DllCall("gdi32.dll", "int", "GetObject", "hwnd", $hBMP, "int", DllStructGetSize($tBitmap), "ptr", DllStructGetPtr($tBitmap)) Local $tIcon = DllStructCreate("bool Icon; dword XHotSpot; dword YHotSpot; handle hMask; handle hColor") DllStructSetData($tIcon, 1, True) DllStructSetData($tIcon, 2, 0) DllStructSetData($tIcon, 3, 0) DllStructSetData($tIcon, 4, $hBMP) DllStructSetData($tIcon, 5, $hBMP) $aResult = DllCall("user32.dll", "ptr", "CreateIconIndirect", "ptr", DllStructGetPtr($tIcon)) If @error Or Not $aResult[0] Then _WinAPI_DeleteObject($hBMP) Return SetError(1, 2, False) EndIf _WinAPI_DeleteObject($hBMP) Local $aReturn[3] $aReturn[0] = $aResult[0] $aReturn[1] = DllStructGetData($tBitmap, "bmWidth") $aReturn[2] = DllStructGetData($tBitmap, "bmHeight") Return $aReturn EndFunc ;==>_LoadSprite Func _DestroySprite(ByRef $aSprite) If UBound($aSprite) <> 3 Then Return SetError(1, 1, False) _WinAPI_DestroyIcon($aSprite[0]) $aSprite = 0 EndFunc ;==>_DestroySprite Func _Draw() _WinAPI_SelectObject($hDC_Draw, $hBmp_Background) For $x = 0 To 320 Step 128 For $y = 0 To 240 Step 128 _WinAPI_BitBlt($hDC_Buffer, $x, $y, 128, 128, $hDC_Draw, 0, 0, $SRCCOPY) Next Next Local Static $iStep = 0, $iX = 10 $iStep += 1 If $iStep > 7 Then $iStep = 0 $iX += 2 If $iX > 320 Then $iX = -30 If $iStep < 6 Then _DrawSprite($hDC_Buffer, $aMario[Floor($iStep / 2)], $iX, 160, 2) Else _DrawSprite($hDC_Buffer, $aMario[1], $iX, 160, 2) EndIf _WinAPI_BitBlt($hDC, 0, 0, 320, 240, $hDC_Buffer, 0, 0, $SRCCOPY) EndFunc ;==>_Draw Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _WinAPI_BitBlt($hDC, 0, 0, 320, 240, $hDC_Buffer, 0, 0, $SRCCOPY) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func _Exit() _DestroySprite($aMario[0]) _DestroySprite($aMario[1]) _DestroySprite($aMario[2]) _WinAPI_DeleteObject($hBmp_Buffer) _WinAPI_DeleteObject($hBmp_Background) _WinAPI_DeleteDC($hDC_Draw) _WinAPI_DeleteDC($hDC_Buffer) _WinAPI_ReleaseDC($hGui, $hDC) Exit EndFunc ;==>_Exit Images and Code here: http://www.autoit.de/index.php?page=Atta...348629663371c46c8f862ad5f36fa5 E
    1 point
  12. Guys good time of day. Help please with function thas controls drop-down combo-box. I'm trying to do it in that way: ControlCommand ("Save As", "Save in", "ComboBox1", "SelectString", "New Folder")but have no success. It's not chahged for New Folder instead of PQI. The full text of script is next: Run ("notepad.exe") WinWaitActive ("Untitled - Notepad") Send ("This is some test.") WinClose ("Untitled - Notepad") WinWaitActive ("Notepad", "The text in the Untitled file has changed.") Send ("!y") WinWaitActive ("Save As") ControlCommand ("Save As", "Save in", "ComboBox1", "SelectString", "New Folder")
    1 point
  13. ..vom feinsten solution is here let's do cool stuff To find a string-occurrence and to select the right comcobox-entry use sth. like the following: $hwnd = ControlGethandle("Bild speichern als ...","","ComboBox2") ;ControlGethandle("title", "text", "classnameNN") Global $CB_FINDSTRING = 0x014C $i = dllcall("user32.dll","int","SendMessage","hWnd",$hwnd,"int",$CB_FINDSTRING,"int", -1,"str", "jpg") ; search for the string "jpg" ControlCommand ("Bild speichern als ...","", "ComboBox2","SetCurrentSelection",$i[0]) msdn.microsoft.com - CB_FINDSTRING For the hex-codes of different commands look into the winuser.h (if you got it) or use google example: a webpage whith hex-codes of different commands edit: added code for this specific topic
    1 point
×
×
  • Create New...