icadea Posted November 5, 2007 Share Posted November 5, 2007 This is one the HELP file examples in AUTO3LIB under _GDIP_ImageSaveToFile #include <A3LGDIPlus.au3> #include <A3LScreenCap.au3> Global $hBitmap1, $hBitmap2, $hImage1, $hImage2 ; Initialize GDI+ library _GDIP_Startup() ; Capture full screen $hBitmap1 = _ScreenCap_Capture("") $hImage1 = _GDIP_BitmapCreateFromHBITMAP($hBitmap1) ; Save resultant image _GDIP_ImageSaveToFile($hImage1, FileSaveDialog("Choose a name.", @ScriptDir, "all (*.*)", 18) & ".jpg") ; Clean up resources _GDIP_ImageDispose($hImage1) _GDIP_ImageDispose($hImage2) _API_DeleteObject($hBitmap1) _API_DeleteObject($hBitmap2) ; Shut down GDI+ library _GDIP_ShutDown() When I insert the FileSaveDialog inside _GDIP_ImageSaveToFile, the program will prompt for location and filename to save. A filename is given and the SAVE button is pressed. The SAVED given filename is shown on the location. The problem is, if I were to press Cancel or ESC button on the FileSaveDialog, a NONAME jpg file is saved on the compiled program directory. How do i eliminate this? Please help by showing if i miss any code lines. thanks. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 5, 2007 Moderators Share Posted November 5, 2007 Well for the obvious answer, if you wrap a function call within another function, you are not going to get the function call's (in this case FileSaveDialog) error flag unless the function you are calling has made account for it (which is doubtful, as many don't nest their functions). So the obvious answer:$sFSD = FileSaveDialog("Choose a name.", @ScriptDir, "all (*.*)", 18) If @error Then Exit _GDIP_ImageSaveToFile($hImage1, $sFSD & ".jpg") Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
icadea Posted November 5, 2007 Author Share Posted November 5, 2007 thanks for the quick help. works like a charm. Link to comment Share on other sites More sharing options...
icadea Posted November 7, 2007 Author Share Posted November 7, 2007 So the obvious answer:$sFSD = FileSaveDialog("Choose a name.", @ScriptDir, "all (*.*)", 18) If @error Then Exit _GDIP_ImageSaveToFile($hImage1, $sFSD & ".jpg") Link to comment Share on other sites More sharing options...
ChrisL Posted November 7, 2007 Share Posted November 7, 2007 While 1 Wend Func screen () $sFSD = FileSaveDialog("Choose a name.", @ScriptDir, "all (*.*)", 18) If @error Then Return _GDIP_ImageSaveToFile($hImage1, $sFSD & ".jpg") EndFunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
icadea Posted November 9, 2007 Author Share Posted November 9, 2007 thanks, works great. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now