Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/11/2015 in all areas

  1. Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^
    1 point
  2. Use RunWait. This waits until the called program has finished processing.
    1 point
  3. Glad all problems could be solved What should you learn from this thread? Always carefully read what Jos tells you to do! That would have saved you and us a lot of time
    1 point
  4. Iam in general not known for length walls of words, so find it special you missed the end of the first sentence defining the first requirement! You also need to compile the script or else you obviously can't re-shell it for running your downloaded script. Jos
    1 point
  5. Insert the following line at the top of your script (that is what Jos mentioned in the text of post #9): #pragma compile(AutoItExecuteAllowed, true)
    1 point
  6. Did you insert the #pragma statement as Jos told you in post #9?
    1 point
  7. Did you do both things I mentioned in my post since I am missing the first part? Jos
    1 point
  8. You need to use the code Jos provided in post #9 to execute the au3 file!
    1 point
  9. Of course not ... I am just bullshitting.
    1 point
  10. As you use the @TempDir macro to write and read/execute the script it should work on any computer.
    1 point
  11. Have you tried? If yes, which errors did you get?
    1 point
  12. No problem if you compile the script using the directives as Jos said BTW use ShellExecuteWait instead of ShellExecute so you can remove the sleep()
    1 point
  13. You can use the compiled script also as the stub to run the file, but make sure you use the "#pragma compile(AutoItExecuteAllowed, true)". RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $tmp & '"')Jos
    1 point
  14. Compile the script and run the resulting Exe.
    1 point
  15. Hmm sorry, the file was deleted too fast #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GuiSetState() Local $dData = "msgbox(0,'', 'this is a test')" ;BinaryToString(InetRead("http://example.com/my.html", 1)) $tmp = @tempdir & "\test.au3" FileWrite($tmp, $dData) ShellExecute($tmp) sleep(1000) FileDelete($tmp) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
    1 point
  16. Loop up Assign() in the Helpfile. Jos
    1 point
  17. Check on the help for StderrRead / StdoutRead so you can get the output from ffmpeg command line P.S. In $ffmpeg_command don't forget the quotes " " if there are space in the path/variable like: '"' & $TsPath & '"'
    1 point
  18. Godot was here. Run Program1.au3. Program1.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt( "MustDeclareVars", 1 ) Example() Func Example() ShellExecute( "Program2.au3" ) While Not FileExists( "Labels.txt" ) Sleep( 50 ) WEnd Local $sLabels = FileReadLine( "Labels.txt" ) Local $aLabels = StringSplit( $sLabels, "|", 2 ) ; 2 = $STR_NOCOUNT Local $hProgram2 = $aLabels[0] ; 101 rows in $aLabels, $hProgram2 = $aLabels[0], labels in $aLabels[1-100] Local $tRECT = DllStructCreate( $tagRECT ) DllStructSetData( $tRECT, 'Left', 0 ) DllStructSetData( $tRECT, 'Top', 0 ) DllStructSetData( $tRECT, 'Right', 70 ) DllStructSetData( $tRECT, 'Bottom', 20 ) Local $pRECT = DllStructGetPtr( $tRECT ) Local $hProgram1 = GUICreate( "Program 1", 200, 100, 100, 100 ) Local $idColors = GUICtrlCreateButton( "Set colors", 50, 30, 100, 40 ) GUISetState( @SW_SHOW, $hProgram1 ) Local $hDC, $iColor, $hBrush, $sCtrl While 1 Switch GUIGetMsg() Case $idColors For $i = 1 To 100 $hDC = _WinAPI_GetDC( $aLabels[$i] ) $iColor = ColorConvert( Random(0,255,1)+256*Random(0,255,1)+256*256*Random(0,255,1) ) ; BGR $hBrush = _WinAPI_CreateSolidBrush( $iColor ) _WinAPI_FillRect( $hDC, $pRECT, $hBrush ) _WinAPI_SetBkColor( $hDC, $iColor ) _WinAPI_DrawText( $hDC, $i, $tRECT, $DT_CENTER) _WinAPI_ReleaseDC( $aLabels[$i], $hDC ) _WinAPI_DeleteObject( $hBrush ) Next Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd FileDelete( "Labels.txt" ) GUIDelete( $hProgram1 ) WinClose( $hProgram2 ) EndFunc ; RGB to BGR or BGR to RGB Func ColorConvert($iColor) Return BitOR(BitAND($iColor, 0x00FF00), BitShift(BitAND($iColor, 0x0000FF), -16), BitShift(BitAND($iColor, 0xFF0000), 16)) EndFunc Program2.au3 #include <GUIConstantsEx.au3> Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $hProgram2 = GUICreate( "Program 2", 810, 310 ) Local $sLabels = $hProgram2 For $i = 0 To 99 $sLabels &= "|" & GUICtrlGetHandle( GUICtrlCreateLabel( $i+1, 10+80*Mod($i,10), 10+30*Int($i/10), 70, 20, 0x01 ) ) ; 0x01 = $SS_CENTER Next Local $hFile = FileOpen( "Labels.txt", 2 ) ; 2 = $FO_OVERWRITE FileWriteLine( $hFile, $sLabels ) FileClose( $hFile ) GUISetState( @SW_SHOW, $hProgram2 ) GUISwitch( $hProgram2 ) While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd EndFunc
    1 point
  19. water

    Removing Bunch of spaces

    My bad, should be: Global $editBox = GUICtrlCreateEdit(_ArrayToString($aFileArray, @CRLF), 5, 250, 395, 400)
    1 point
  20. water

    Removing Bunch of spaces

    You are reading the whole file into one variable. Using StringStripWS on this variable will only remove white space from the last line. Means: Use FileReadToArray to read the file into an array, then loop through the array and use StringStripWS on every element.
    1 point
  21. water

    Removing Bunch of spaces

    How did you use StringStripWS? This function should be exactly what you are looking for.
    1 point
  22. scila1996, You can do it like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> ; Set flag to indicate double click $fDblClk = False ; Row Col values Global $iRow, $iCol ; Create GUI $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("Col 1 |Col 2 ", 10, 10, 200, 200) For $i = 0 To 19 GUICtrlCreateListViewItem("Item " & $i & "-0|Sub " & $i & "-1", $cLV) Next GUISetState() ; Register NOTIFY messages GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; If the ListView was clicked If $fDblClk = True Then ; Announce where MsgBox($MB_SYSTEMMODAL, "", "You double-clicked the ListView:" & @CRLF & "Row" & @TAB & $iRow & @CRLF & "Col" & @TAB & $iCol) ; Reset the flag $fDblClk = False EndIf WEnd ; React to NOTIFY messages Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return ; Is it our ListView that has been actioned? If DllStructGetData($tStruct, 1) = GUICtrlGetHandle($cLV) Then ; Was it a double click? If DllStructGetData($tStruct, 3) = $NM_DBLCLK Then ; Set the flag $fDblClk = True ; And the values $iRow = DllStructGetData($tStruct, 4) $iCol = DllStructGetData($tStruct, 5) EndIf EndIf $tStruct = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFYIt does not matter which function you use to fill the list view- it will still work uisng _GUICtrlListView_AddItem. Please ask if you have any questions M23
    1 point
  23. TX.exe updates labels sequentially / serial Each of those updates at the same time / parallel Any bottle neck with be the main process handling its window message queue.
    1 point
  24. MyEarth

    Detect GPT Drive

    Untested ConsoleWrite("_IsDiskGPT: " & _IsDiskGPT() & @CRLF) Func _IsDiskGPT() Local $oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") If Not IsObj($oWMIService) Then Return SetError(1, 0, 0) Local $o_ProcessInfo = $oWMIService.ExecQuery("Select * from Win32_DiskPartition WHERE Index = 0") Local $sReturn For $o_ObjProcess In $o_ProcessInfo $sReturn = $o_ObjProcess.Type ExitLoop Next If StringInStr($sReturn, "GPT") Then Return 1 Return 0 EndFunc ;==>_IsDiskGPT
    1 point
  25. Yes, put the code in a function and see adlibregister in help file.
    1 point
  26. This construct looks fine to me. There may be alternatives - but I'm not aware of them. You need to clearly define the syntax of your language and also make sure you only pass expressions which the interpreter can actually execute. This will likely require some preprocessing of the expression depending on syntax. You need to know how to interpret the results of the executed expression: because AutoIt is a loosely typed language and can sometimes throw up some unexpected results. Ask yourself - What are the advantages (and disadvantages) of creating an alternative syntax (or language)? Start with some very simple expressions and test them against expected results. Be aware that Execute() is only intended for simple (single line) expressions passed as strings. Internal conversions can play havoc if you don't pay attention to certain limitations (not so easy to define).
    1 point
  27. The following 9 ConsoleWrites all return True. Local $a = True Local $b = True Local $c = False ConsoleWrite(($a And $b And (Not $c)) & @LF) ConsoleWrite(Execute("$a And $b And (Not $c)") & @LF) ConsoleWrite(($a Or $c) & @LF) ConsoleWrite(Execute("$a Or $c") & @LF) ConsoleWrite((BitAND(23, 12) = 4) & @LF) ConsoleWrite(Execute("BitAnd(23, 12) = 4") & @LF) ; Note quotation marks around the strings. ConsoleWrite(("abcd" = "abcd") & @LF) ConsoleWrite(Execute('"abcd" = "Abcd"') & @LF) ; Case insensitive ConsoleWrite(Execute('"abcd" == "abcd"') & @LF) ; Case sensitive
    1 point
  28. Oh I'm sure I know how to help you, I'm just not sure if you're able to post a script that demonstrates what you're trying to do. In my humble opinion, whatever you're using Execute for, can probably be done without it, you should try it and see.
    1 point
  29. Do not define a global variable in a function. Define it at the top of the script. If the function where the global variable is being defined never gets called but the variable gets referenced then you see the error you get.
    1 point
  30. @BrewManNH Note:' Execute("string=string")' is not just string comparison. The string has to be a function name to return True. This is the case on my system. The following 10 ConsoleWrites all return True. ConsoleWrite(Execute("string = string") & @LF) ConsoleWrite(Execute("3 >= 0") & @LF) ConsoleWrite(Execute("0 <= 3") & @LF) ConsoleWrite(Execute("1 <> 0") & @LF) ConsoleWrite("(string = string): " & (string = string) & @LF) ConsoleWrite("(Default = Default): " & (Default = Default) & @LF) ConsoleWrite("(FileExists = FileExists): " & (FileExists = FileExists) & @LF) ConsoleWrite((3 >= 0) & @LF) ConsoleWrite((0 <= 3) & @LF) ConsoleWrite((1 <> 0) & @LF)
    1 point
  31. Maybe you shouldn't be using Execute for whatever it is you're trying to do? Execute("3>=0") will return True because the comparison evaluates that 3 greater than or equal to 0. (Boolean True = 1) Execute("3=>0") is just written wrong, so it returns an error of 1, and a return value of "" (empty string). Execute("1!=0") is also written wrong because AutoIt doesn't use != as an operator and returns an error of 1 and a return value of "". Not knowing what you're strings contain, it's impossible to say why it returns zero. Although, Execute("string=string") WILL return True if that were your actual comparison strings.
    1 point
  32. UEZ

    PNG in GUI

    Try this then: ;coded by UEZ 2011 #include <guiconstantsex.au3> #include <gdiplus.au3> #Include <memory.au3> _GDIPlus_Startup() Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 Global $msg Global Const $hBmp = Load_BMP_From_Mem(InetRead("http://www.autoitscript.com/forum/public/style_images/autoit/logo.png"), True) ;to load an image from the net Global Const $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) Global Const $iWidth = _GDIPlus_ImageGetWidth($hBitmap) Global Const $iHeight = _GDIPlus_ImageGetHeight($hBitmap) Global Const $hGUI = GUICreate("Display PNG Image in picture control", $iWidth, $iHeight) Global Const $idPic = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)) GUISetState() While True $msg = GUIGetMsg() Switch $msg Case $idPic MsgBox(0, "Information", "PNG image was clicked") Case $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBmp) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndSwitch WEnd ;====================================================================================== ; Function Name: Load_BMP_From_Mem ; Description: Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap ; ; Parameters: $bImage: the binary string which contains any valid image which is supported by GDI+ ; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created ; ; Remark: hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format ; Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown() ; ; Requirement(s): GDIPlus.au3, Memory.au3 and _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Return Value(s): Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format), ; Error: 0 ; Error codes: 1: $bImage is not a binary string ; 2: unable to create stream on HGlobal ; 3: unable to create bitmap from stream ; ; Author(s): UEZ ; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines and ; Yashied for _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Version: v0.97 Build 2012-04-10 Beta ;======================================================================================= Func Load_BMP_From_Mem($bImage, $hHBITMAP = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBITMAP Then Local Const $hHBmp = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>Load_BMP_From_Mem Func _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) Local $tBIHDR, $Ret, $tData, $pBits, $hResult = 0 $Ret = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($Ret[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $Ret[2], $Ret[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword') DllStructSetData($tBIHDR, 1, DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 2, $Ret[2]) DllStructSetData($tBIHDR, 3, $Ret[3]) DllStructSetData($tBIHDR, 4, 1) DllStructSetData($tBIHDR, 5, 32) DllStructSetData($tBIHDR, 6, 0) $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $Ret[2] * $Ret[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) Return $hResult EndFunc ;==>_GDIPlus_BitmapCreateDIBFromBitmap Br, UEZ
    1 point
  33. UEZ

    PNG in GUI

    It is possible to display a PNG image in a pic control using GDI+. Example: ;coded by UEZ 2011 #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 Global $msg Global Const $hGUI = GUICreate("Display PNG Image in picture control", 600, 250) Global Const $idPic = GUICtrlCreatePic("", 215, 20) _GDIPlus_Startup() Global Const $png = StringReplace(@AutoItExe, "autoit3.exe", "ExamplesGUITorus.png") Global Const $hImage = _GDIPlus_ImageLoadFromFile($png) Global Const $Bmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $Bmp)) GUISetState() While True $msg = GUIGetMsg() Switch $msg Case $idPic MsgBox(0, "Information", "PNG image was clicked") Case $GUI_EVENT_CLOSE _WinAPI_DeleteObject($Bmp) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndSwitch WEnd This example is using the png picture from the ExamplesGUI folder and displays it in a picture control. Br, UEZ
    1 point
×
×
  • Create New...