Leaderboard
Popular Content
Showing content with the highest reputation on 06/14/2018 in all areas
-
So when I work with Arduino C is my favorite I work in payments in large financial institution COBOL is my favorite which can be in color workspace IDE really nice I work with business people Excel/VBA is my favorite I work with systemadminisators the CMD batch, VBScript or Powershell is my favorite I work with WSDL SoapUI GroovyScript is my favorite I work with HTML JavaScript is my favorite I work with IBM ECM Content Foundation-FileNET APIĀ“s I use C# or Java I work with automating GUI's AutoIt, HP UFT/LeanFT I use I work with Microsoft TFS on CI/CD I learn many API's to deal with (Jenkins, Git, Maven, Nexus) I work with mobile devices you have to focus on either iphone or android language .... Basically about every 10-15 years a major shift on what the younger people preferr as a language for building applications The list can be endless certainly in DEVOPS team(s) you learn (at least high level) all these languages and mess up with how to comment/uncomment lines, line ends with semicolon yes, no concatenate with a plus or an ampersand etc.3 points
-
Did you happen to name it "notepad.exe"? P.S. Welcome to the forum!2 points
-
Scrollbars Made Easy - New version 27 Jan 22
pixelsearch reacted to Melba23 for a topic
[New Version] - 27 Jan 22 New: The GUIScrollbar_Ex UDF now recognises Win-D and taskbar desktop clearance commands and runs the correct minimize/restore code automatically. The previous UDF _Minimize and _Restore commands have been superceded by a single _EventMonitor function which runs in the script idle loop. This is a script-breaking change, but I hope that the additional functionality is worth the small effort it will take to alter your scripts. New UDFs, examples in zip file below. Previous changes: Changelog.txt Are you bemused by scrollbars? > Do you find them too difficult to use? > Then you need the GUIScrollbars_Ex UDF! Just download the zip at the end of the post and run this short script with the UDF in the same folder. No tricky calculations, no complicated functions to master - just easy to use, accurate scrollbars with one command! [size=5]#include <guiconstantsex.au3> #include "GUIScrollbars_Ex.au3" ; Create GUI with red background $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xFF0000, $hGUI) ; Create a 1000x1000 green label GUICtrlCreateLabel("", 0, 0, 1000, 1000) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState() ; Generate scrollbars - Yes, this is all you need to do!!!!!!!!!!!!!!!!!!!! _GUIScrollbars_Generate($hGUI, 1000, 1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd[/size] Try it today and see how easy it is! I have been trying for some time to understand how scrollbars work and how to get them closely to match the area I want to display. After much research and headscratching I have come up with 2 UDFs which I hope will be of use to others. Apologies for the length of this post, but scrollbars are complex beasts and as I did this mainly for the less experienced user I want to make sure that they understand what is going on. The 2 UDFs are: GUIScrollbars_Ex.au3 - This gives you scrollbars sized to your GUI in one simple command - with no other includes or commands needed. The UDF is designed for those who would not normally use scrollbars because the whole process looks too complicated. It also includes a command to enable you to scroll page by page, thus making it easy to scroll to anywhere on the GUI with only simple calulations based on the values you used to create the GUIs. [New] Ability to have recalculated scrollbars on resizeable GUIs. GUIScrollbars_Size.au3 - This calculates the Page and Max numbers for the user to feed into the _GUIScrollbar_SetScrollInfoPage/Max commands. The UDF is aimed at the more experienced user and is particularly useful when you have a GUI with a dynamic scroll size (i.e. adding or subtracting controls to the scrollable area as the script runs). First, a short tutorial for those who are interested in how the scrollbars affect your GUI and what it is that the UDFs calculate: All the files mentioned here are in a downloadable zip file at the end of the post. GUIScrollbars_Size.au3 As mentioned previously, the GUIScrollbars_Size.au3 UDF is aimed at the more experienced user who wants to use the full range of _GUIScrollbar comands, but would like a quick way of getting the required Page and Max values. It uses no other include files so you will need to include GUIScrollbars.au3 yourself, as well as the necessary GUIRegisterMsg and procedures for WM_VSCROLL and WM_HSCROLL. The syntax is simple - the size of the scrollable GUI and either the handle of the GUI you have created to hold the scrollbars or the size of the one you are going to create. It returns a 6-element array including the Page and Max values for the scrollbars and factors to compensate for the "shrinkage" of the GUI if you had already drawn some controls and wished to add others. Of interest, the returned Max value is biased not to clip the edges of the GUI - reducing it by 1 makes a tighter fit but can lead to some clipping. (If that does not make sense, please see the tutorial above for more details) The Size_Example_1 script to show the UDF in action - the "Pass Size" button shows the effect of creating the scrollbars BEFORE the controls, the "Pass Handle" button shows what happens if the scrollbars are created AFTER the controls. If you do not understand why there is a difference - go and read the tutorial above ! You will need to have the GUIScrollbar_Size.au3 UDF in the same folder. Where this UDF really helps is if you have a scrollable GUI of variable size - if the number of controls varies with user selections for example. All you need to do is to rerun the UDF with the new size of the scrollable GUI and it produces a new Max value for you to use. The Size_Example_2 script shows how the function enables you to dynamically size your scrollbars depending on the number of controls required. As before it requires the GUIScrollbar_Size.au3 UDF in the same folder. -------- Now the "simple" GUIScrollbars_Ex.au3 (which is actually the more complex internally as you would expect). This UDF is intended to be the single point of call for creating scrollbars on a GUI - it will automatically add the GUIScrollbars UDF and the WM_VSCROLL and WM_HSCROLL GUIRegisterMsg commands and procedures to your script - so you need no commands other than those within the UDF itself. These commands are _GUIScrollbars_Generate and _GUIScrollbars_Scroll_Page. As you might expect, _GUIScrollbars_Generate generates scrollbars for your GUI. It is usually called AFTER you have added all the controls and all you need to use it is the GUI handle and the size of the underlying GUI you want to scroll. If you so wish, you can also decide to generate the scrollbars BEFORE the controls on the scrollable GUI, and you can choose if you want to risk not quite reaching the edge of the GUI when the scrollbars are at the maximum position. So a basic call could be as simple as: _GUIScrollbars_Generate ($hGUI, 1000, 1000) which would put scrollbars on the $hGUI window allowing a 1000x1000 underlying GUI to be displayed. _GUIScrollbars_Scroll_Page lets you scroll a page at a time. If your GUI was 200 pixels wide, you would have 1000/200 = 5 pages to scroll before reaching the edge - no need to know what the actual Page and Max values are, just use this simple division based on the number you use to draw the GUIs. So: _GUIScrollbars_Scroll_Page ($hGUI, 3) would scroll to the third page - it would display the area between 400 and 600 pixels of the full 1000 pixel width. If you ask for a page over the maximum available, you just scroll to the maximum position - asking for page 1 resets you to the origin. Ex_Example_1 shows the UDF working. You can decide whether to have both or just one scrollbar, whether to create the scrollbars before or after the controls, and whether you want the maximum scroll to be tight to the edge or leave a border. Just select the options you want - the script selects a random width and height for both the scrollbar GUI and the underlying GUI - and press the "Scroll" button to show a single page scroll down and/or right followed by a scroll to the bottom right corner of the GUI. There are labels to let you see the size of the GUI and the accuracy of the page scrolls (please read the tutorial above to understand why these are almost certainly inaccurate). The script requires the GUIScrollbars_Ex.au3 UDF in the same folder. Ex_Example_2 is a really simple example to show how easy generating scrollbars can now become! As you can see - no other includes, no GUIRegisterMsg commands, no WM_H/VSCROLL procedure functions. Just accurate scrolling and proportional thumb sizes. Ex_Example_3 shows the automatic calculation of control positions. Ex_Example_4 shows how to initiate the cursor keys to scroll the GUI as well. [New] Ex_Example_5 shows how to use the new _GUIScrollbarsEx_Resizer function. I hope these 2 UDFs are useful to AutoIt users - I certainly find them so. Here is a zip file with the UDFs and examples: Scrollbars.zip My grateful thanks to the authors of the GUIScrollbars and WinAPI UDFs for their code, some of which I have plundered. And as always I welcome constructive criticism and/or effusive congratulations. M231 point -
Which programming language deserves to be learned?
FrancescoDiMuro reacted to Earthshine for a topic
I feel that way too. Less code, more work done faster with .NET for most of what I do now. also because .NET is Object Oriented and Multithreaded I know C# programmers can make VERY nice livings (six figures), not sure about the perception of VB.NET, even though it is just as powerful and reliable, still, with what you have now, you should do well. Python pays very well from all of my research on the web as well, and, I found out why so many others love it due to that fact, even though I am not pursuing any advancements.1 point -
Registry search
Earthshine reacted to Subz for a topic
@Earthshine that will return the wrong key if script is compiled as 32-bit, it returns 32-bit version of the Hive not the 64-bit version, which is why we need to use HKLM for 32-bit and HKLM64 for 64-bit within 32-bit compiled scripts.1 point -
Which programming language deserves to be learned?
FrancescoDiMuro reacted to Earthshine for a topic
there is nothing C# or other .NET languages can do that VB.NET can't, but if you focus on the big money makers, you could move about in your career, hopefully upward and forward to something you love even more. (I love that in C# I can write less code and do more though, and since I was a C guy for 15 yrs or so, I just love C++ and C# and .NET stuff because of the access to the HUGE libraries out there) oh and by braces I meant the curly ones: { }1 point -
Can you attach an example .xlsx file for testing?1 point
-
Please try the following script and send through a screenshot of the results. #include <GuiListView.au3> Opt("TrayAutoPause", 0) Opt('GUIOnEventMode', 1) Opt('GUICloseOnEsc' , 1) Global $aSoftwareInfo[0][5] _SoftwareInfo("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") _SoftwareInfo("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") Global $hGui = GUICreate('Currently Installed Software', 810, 650, -1, -1) Global $idListView = GUICtrlCreateListView('Registry Key|Installed Software|Display Version|Publisher|Uninstall String', 5, 5, 800, 600) _GUICtrlListView_AddArray($idListView, $aSoftwareInfo) GUICtrlSendMsg($idListView, 0x101E, 1, 175) GUICtrlSendMsg($idListView, 0x101E, 2, 65) GUICtrlSendMsg($idListView, 0x101E, 3, 150) GUICtrlSendMsg($idListView, 0x101E, 4, 350) Local $mMen = GUICtrlCreateContextMenu($idListView) Local $Uninstall = GUICtrlCreateMenuItem('Proceed to Software uninstallation', $mMen) GUICtrlSetOnEvent($Uninstall, '_Uninstall') Local $exp = GUICtrlCreateButton(' Expand ', 720, 615) GUICtrlSetOnEvent($exp, '_Expand') GUISetOnEvent(-3, '_AllExit') GUISetState(@SW_SHOW, $hGui) While 1 Sleep(10) WEnd ; Func _AllExit() GUIDelete($hGui) Exit EndFunc Func _Uninstall() Local $proc = StringSplit(GUICtrlRead(GUICtrlRead($idListView)), '|', 1) If $proc[1] == 0 Then Return -1 ShellExecuteWait ($proc[5]) EndFunc Func _SoftwareInfo($_sHKLMUninstall) Local $i = 1 While 1 $sRegKey = RegEnumKey($_sHKLMUninstall, $i) If @error Then Exitloop If RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayName") = '' Then $i += 1 ContinueLoop EndIf $sDisplayName = StringStripWS(StringReplace(RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayName"), " (remove only)", ""), 3) $sDisplayVersion = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "DisplayVersion"), 3) $sPublisher = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "Publisher"), 3) $sUninstallString = StringStripWS(RegRead($_sHKLMUninstall & "\" & $sRegKey, "UninstallString"), 3) _ArrayAdd($aSoftwareInfo, $_sHKLMUninstall & "\" & $sRegKey & "|" & $sDisplayName & "|" & $sDisplayVersion & "|" & $sPublisher & "|" & $sUninstallString) $i += 1 WEnd _ArraySort($aSoftwareInfo,0,1) EndFunc ; Func _Expand() _GUICtrlListView_SetColumnWidth($idListView, 0, $LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth($idListView, 1, $LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth($idListView, 2, $LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth($idListView, 3, $LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth($idListView, 4, $LVSCW_AUTOSIZE) EndFunc1 point
-
Which programming language deserves to be learned?
Earthshine reacted to FrancescoDiMuro for a topic
Good morning @junkew Wow! What a long list of favourites programming languages I'm not so expert to know the 50% percent of these programming language, but I used: C ( for Arduino and not ); VBA for what I do for work ( SCADA programmer ); Batches always for work applications; JavaScript a little bit when I was at school; AutoIt, for a lot of stuffs, and, actually, for a project of mine which is a Management, and I don't know if AutoIt is the best programming language to do this thing with. And now, just because I know that AutoIt is not as much reliable as a VB.NET ( and others ) could be, I'd like to learn a language which offers a lot, in almost everything about database management, GUIs, and so on... Thanks a lot for your reply Have a good day Best Regards.1 point -
Protect a single exe
Earthshine reacted to Juvigy for a topic
Put the EXE for example calc.exe in a Citrix desktop. You can know who is logged in in the citrix and using the app. And you can have AD logins to the citrix desktop so only registered and allowed users can use the app. Users will not be able to change anything in the citrix environment.1 point -
Ui's in the web page are disabled only when automated
232showtime reacted to junkew for a topic
With no detail given: check the Frequently Asked Questions at least number 31. I have not seen any html page beeing protected from automation and cannot imagine there is a way to protect html from automation.1 point -
Use autoclick mouse on the VPS
DynamicRookie reacted to Jos for a topic
;Activate your game window @Andriy, Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. (there is also a link in my signature) Please read them now particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. Jos1 point -
Overlay graphic/label
GregEisenberg reacted to Cotino for a topic
Here is a simplified version : #include <WindowsConstants.au3> #include <GDIPlus.au3> HotKeySet("{ESC}", "_Exit") ; Only way to exit Opt("GUIOnEventMode", 1) ; Set event mode ;~ Opt("TrayIconHide", 1) ; Hide tray icon ; ###################### ; Global parameters $iX = 0 ; -1 for centered $iY = 0 $iWidth = @DesktopWidth $iHeight = @DesktopHeight ; ###################### ; Create Graphic _GDIPlus_Startup() $hGUI = GUICreate("", $iWidth, $iHeight, $iX, $iY, 0, $WS_EX_TRANSPARENT + $WS_EX_LAYERED + $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) $ScreenDc = _WinAPI_GetDC($hGUI) $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hbitmap) $dc = _WinAPI_CreateCompatibleDC($ScreenDc) ; ###################### ; _WinAPI_UpdateLayeredWindow parameters $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $iWidth) DllStructSetData($tSize, "Y", $iHeight) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", 255) DllStructSetData($tBlend, "Format", 1) ; struct tSize { X = $iWidth, Y = $iHeight } (pointer pSize) ; struct tSource { } (pointer pSource) ; struct tBlend { Alpha = 255, Format = 1 } (pointer pBlend) ; ########################################### ; Create shapes _GDIPlus_GraphicsClear($hBackbuffer, 0) $hBrush = _GDIPlus_BrushCreateSolid(0) $hPen = _GDIPlus_PenCreate(0) #cs GDIPlus memo : Use pen to draw (outline of shape) Use brush to fill You can fill without drawing Alpha : 00 is transparent. FF is opaque ARGB : 0xAARRGGBB Pen : _GDIPlus_PenSetWidth($hPen, widthInPixel) _GDIPlus_PenSetColor($hPen, ARGB) Brush : _GDIPlus_BrushSetSolidColor($hBrush, ARGB) Rectangle : _GDIPlus_GraphicsDrawRect($hBackbuffer, X, Y, width, height, $hPen) _GDIPlus_GraphicsFillRect($hBackbuffer, X, Y, width, height, $hBrush) Ellipse : _GDIPlus_GraphicsDrawEllipse($hBackbuffer, X, Y, width, height, $hPen) _GDIPlus_GraphicsFillEllipse($hBackbuffer, X, Y, width, height, $hBrush) String : All of the following are needed $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, fontSize) $tLayout = _GDIPlus_RectFCreate(X, Y) $sString = "String" $aInfo = _GDIPlus_GraphicsMeasureString($hBackBuffer, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hBackBuffer, $sString, $hFont, $aInfo[0], $hFormat, $hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) More complex shapes are available Search for _GDIPlus_Graphics in the help #ce ; ########################################### ; Write your shapes below ;~ ; Red transparent rectangle ;~ _GDIPlus_BrushSetSolidColor($hBrush, 0x60FF0000) ;~ _GDIPlus_GraphicsFillRect($hBackbuffer, $iWidth/2-$iX-100, $iHeight/2-$iY-100, 200, 200, $hBrush) ;~ ; Blue circle outline ;~ _GDIPlus_PenSetWidth($hPen, 5) ;~ _GDIPlus_PenSetColor($hPen, 0xFF0000FF) ;~ _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $iX, $iY, $iWidth, $iHeight, $hPen) ;~ ; Green string ;~ _GDIPlus_BrushSetSolidColor($hBrush, 0xFF00FF00) ;~ $hFormat = _GDIPlus_StringFormatCreate() ;~ $hFamily = _GDIPlus_FontFamilyCreate("Consolas") ;~ $hFont = _GDIPlus_FontCreate($hFamily, 20, 1) ;~ $tLayout = _GDIPlus_RectFCreate($iWidth/2-$iX, $iHeight/2-$iY-200) ;~ $sString = "I am a green opaque string" ;~ $aInfo = _GDIPlus_GraphicsMeasureString($hBackBuffer, $sString, $hFont, $tLayout, $hFormat) ;~ _GDIPlus_GraphicsDrawStringEx($hBackBuffer, $sString, $hFont, $aInfo[0], $hFormat, $hBrush) ;~ _GDIPlus_FontDispose($hFont) ;~ _GDIPlus_FontFamilyDispose($hFamily) ;~ _GDIPlus_StringFormatDispose($hFormat) ; ########################################### _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) ; ########################################### ; Show image $hBmp = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $GDIP_PXF32ARGB) $hContext = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsDrawImageRect($hContext, $hBitmap, 0, 0, $iWidth, $iHeight) $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_SelectObject($dc, $gdibitmap) _WinAPI_UpdateLayeredWindow($hGUI, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2) _WinAPI_DeleteObject($gdibitmap) _WinAPI_RedrawWindow($hGUI) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBmp) ; ########################################### GUISetState(@SW_SHOW, $hGUI) While 1 Sleep(10) WEnd Func _Exit() _WinAPI_DeleteDC($dc) _WinAPI_ReleaseDC($hGUI, $ScreenDc) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndFunc _GDIPlus_GraphicsDrawStringEx makes the string have a black outline, which makes small font size unreadable. Aside from that it works pretty neatly, i don't quite understand everything that's going on but it works. Just modify the part under "Write your shapes below" and eventually the global parameters if you want to modify the window size.1 point -
pdjhh, -1. No recorder included: For the very good reason explained in the first post - which is why you do not get a direct link. -2. no recorder listed on their website: And yet this thread is pinned on the main Help section of the forum for that very reason. -3. can't fill out a contact us form as it keep s saying it's spam: I get lots of emails from people using the contact form (in fact I have just dealt with one) - could it be you causing the problem? -4. website is covered in ads: AutoIt is entirely free - how else do you expect us to pay for the server costs? Anyway, as you seem to have so much trouble getting to the file I extracted it from the linked zip with no difficulty at all and it is now sitting on my hard drive - please PM me if you require a copy. M23 Edit: This is not a general offer. I expect anyone else to do extract the file themselves as it is trivial to do so, despite the protestations of a certain poster.1 point
-
I just ran this and got 5 message boxes as I suspected. If you're having problems Mikeman27294 please post a re-producing script of the problem. AU3_Example.txt file: MsgBox(0, "It Works", "Hello World") AutoIt Script: _RunAU3("AU3_Example.txt") _RunAU3("AU3_Example.txt") _RunAU3("AU3_Example.txt") _RunAU3("AU3_Example.txt") _RunAU3("AU3_Example.txt") Func _RunAU3($sFilePath, $sWorkingDir = "", $iShowFlag = @SW_SHOW, $iOptFlag = 0) Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"', $sWorkingDir, $iShowFlag, $iOptFlag) EndFunc ;==>_RunAU3 SmartAlec, This is an example of how to do it, though I still expect you to do a bit of research on the subject.1 point
-
Getting image size
PoojaKrishna reacted to Malkey for a topic
The three results that differ having run wakillon's script on my XP are:- 26 : w x h 27 : w pixels 28 : h pixels wakillon's results on XP: 30 : w x h 31 : w pixels 32 : h pixels Melba23's equivalent result on Vista and Win 7 (8 months ago): 31 : w x h Melba23's equivalent result on XP: 26 : w x h (same as mine) It appears this "object.GetDetailsOf()" method to obtain an image's size is subject to error. Test this _ImageSize() function. It is a stand alone function using gdiplus dllcalls, and works fine on my XP. ; Local $FullFileName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" ;Local $FullFileName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\sampleAVI.avi" Local $a = _ImageSize($FullFileName) If @error Then MsgBox(0, "Results", '"' & $FullFileName & '" file does not exist, or is not a valid image file.') Else MsgBox(0, "Results", '"' & $FullFileName & '" - Size: ' & $a[0] & " x " & $a[1]) EndIf ; Returns Array[0] - width of image. ; Array[1] - heigth of image. Func _ImageSize($sFileName) Local $aRet[2], $sExt = StringRegExpReplace($sFileName, "^.*\.", "") If (FileExists($sFileName) = 0) Or _ ((StringLen($sExt) = 3) And (StringRegExp($sExt, "(?i)(bmp|gif|jpg|png|tif|emf|wmf)") = 0)) Or _ ((StringLen($sExt) = 4) And (StringRegExp($sExt, "(?i)(tiff|jpeg)") = 0)) Then _ Return SetError(1, 0, $aRet) Local $ghGDIPDll = DllOpen("GDIPlus.dll") Local $tInput = DllStructCreate("int Version;ptr Callback;int NoThread;int NoCodecs") Local $tToken = DllStructCreate("ulong_ptr Data") DllStructSetData($tInput, "Version", 1) DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", DllStructGetPtr($tToken), "ptr", DllStructGetPtr($tInput), "ptr", 0) Local $aImage = DllCall($ghGDIPDll, "int", "GdipLoadImageFromFile", "wstr", $sFileName, "ptr*", 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageWidth", "handle", $aImage[2], "uint*", -1) $aRet[0] = $aResult[2] $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageHeight", "handle", $aImage[2], "uint*", 0) $aRet[1] = $aResult[2] DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $aImage[2]) DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ptr", DllStructGetData($tToken, "Data")) DllClose($ghGDIPDll) Return SetError(0, 0, $aRet) EndFunc ;==>_ImageSize1 point -
Ka36ek, This question has been asked and answered many, many times, so searching will get you lots of idesa! My favourite to date is this one: ; Based on code from Yasheid #include <GUIConstantsEx.au3> Opt("WinTitleMatchMode", 3) Global Const $WM_COPYDATA = 0x004A Global $sThis_Win_Title, $sThat_Win_Title Global $iY, $hInput, $hButton, $hLabel Global $sMsg_To_Send, $sMsg_Rcvd, $sMsg_Set = "" ; Set GUI title If WinExists("First Instance") Then If WinExists("Second Instance") Then Exit $sThis_Win_Title = "Second Instance" $sThat_Win_Title = "First Instance" $iY = 300 Else $sThis_Win_Title = "First Instance" $sThat_Win_Title = "Second Instance" $iY = 100 EndIf ; Create GUI GUICreate($sThis_Win_Title, 400, 150, 100, $iY) $hInput = GUICtrlCreateInput("", 20, 20, 360, 20) $hButton = GUICtrlCreateButton("Send", 160, 60, 80, 30) $hLabel = GUICtrlCreateLabel("", 20, 100, 360, 20) GUIRegisterMsg($WM_COPYDATA, "_WM_COPYDATA") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; Send close message to other window _SendData(WinGetHandle($sThat_Win_Title), "@exit") Exit Case $hButton ; Send message to other window $sMsg_To_Send = GUICtrlRead($hInput) $hWnd = WinGetHandle($sThat_Win_Title) If (Not @error) And ($sMsg_To_Send <> "") Then _SendData($hWnd, $sMsg_To_Send) EndSwitch ; Check messages received If $sMsg_Rcvd = "@exit" Then Exit If $sMsg_Rcvd <> $sMsg_Set Then GUICtrlSetData($hLabel, $sMsg_Rcvd) $sMsg_Set = $sMsg_Rcvd EndIf WEnd Func _SendData($hWnd, $sData) Local $tCOPYDATA, $tMsg $tMsg = DllStructCreate("char[" & StringLen($sData) + 1 & "]") DllStructSetData($tMsg, 1, $sData) $tCOPYDATA = DllStructCreate("dword;dword;ptr") DllStructSetData($tCOPYDATA, 2, StringLen($sData) + 1) DllStructSetData($tCOPYDATA, 3, DllStructGetPtr($tMsg)) $Ret = DllCall("user32.dll", "lparam", "SendMessage", "hwnd", $hWnd, "int", $WM_COPYDATA, "wparam", 0, "lparam", DllStructGetPtr($tCOPYDATA)) If (@error) Or ($Ret[0] = -1) Then Return 0 Return 1 EndFunc ;==>_SendData Func _WM_COPYDATA($hWnd, $msgID, $wParam, $lParam) Local $tCOPYDATA = DllStructCreate("dword;dword;ptr", $lParam) Local $tMsg = DllStructCreate("char[" & DllStructGetData($tCOPYDATA, 2) & "]", DllStructGetData($tCOPYDATA, 3)) $sMsg_Rcvd = DllStructGetData($tMsg, 1) Return 0 EndFunc ;==>_WM_COPYDATA Just compile it and then start 2 instances. You can then pass messages back and forth between the GUIs. M231 point