Volgar Posted May 15, 2009 Share Posted May 15, 2009 (edited) Hi, Several months ago I asked how to use AutoIt to make a screenshot. Thanks @FireFox, I realized all of this. #include <ScreenCapture.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $out = FileSaveDialog('Save screenshot', '', '(*.bmp)',1+2,'screenshot.bmp') _ScreenCapture_SaveImage($out, $scc) Now I want to name the file that generates the AutoIt (screenshot.bmp) was random, such as "a1rld232tsdyzh2.bmp". How can this be done? I can do this of my program, but how then can send a variable containing the file name to the script? Is it possible to run script with parameters? Most simply that comes to mind is to create a text file with the file name and read it by AutoIt and then record in the variable. Edited May 15, 2009 by Volgar Link to comment Share on other sites More sharing options...
Yashied Posted May 15, 2009 Share Posted May 15, 2009 TempFile()? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Volgar Posted May 15, 2009 Author Share Posted May 15, 2009 (edited) TempFile()?Maybe. I am totally new to AutoIt. Where i can read about this feature, please? Edited May 15, 2009 by Volgar Link to comment Share on other sites More sharing options...
Yashied Posted May 15, 2009 Share Posted May 15, 2009 Help File. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Volgar Posted May 15, 2009 Author Share Posted May 15, 2009 Thanks Yashied. I looked up an example from Help, this is what I want. Only I do not understand how the variable $s_FileName send instead 'screenshot.bmp', and then how to write a text file with $s_FileName? Link to comment Share on other sites More sharing options...
Yashied Posted May 15, 2009 Share Posted May 15, 2009 Thanks Yashied. I looked up an example from Help, this is what I want. Only I do not understand how the variable $s_FileName send instead 'screenshot.bmp', and then how to write a text file with $s_FileName?$s_FileName = _TempFile(@TempDir, "~", ".bmp") My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Volgar Posted May 15, 2009 Author Share Posted May 15, 2009 #include <ScreenCapture.au3> #Include <File.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $s_FileName = _TempFile(@TempDir, "~", ".bmp") $out = FileSaveDialog('Save screenshot', '', '(*.bmp)',1+2,'screenshot.bmp') _ScreenCapture_SaveImage($out, $scc) MsgBox(4096, "Info", "Names suitable for new temporary file : " & @LF & @LF & $s_FileName) I apologize, but did not understand how the filename in the variable $s_FileName may be transmitted instead of 'screenshot.bmp'...... Link to comment Share on other sites More sharing options...
Yashied Posted May 15, 2009 Share Posted May 15, 2009 #include <ScreenCapture.au3> #Include <File.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $s_FileName = _TempFile(@TempDir, "~", ".bmp") $out = FileSaveDialog('Save screenshot', '', '(*.bmp)',1+2,'screenshot.bmp') _ScreenCapture_SaveImage($out, $scc) MsgBox(4096, "Info", "Names suitable for new temporary file : " & @LF & @LF & $s_FileName) I apologize, but did not understand how the filename in the variable $s_FileName may be transmitted instead of 'screenshot.bmp'...... #include <ScreenCapture.au3> #Include <File.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $s_FileName = _TempFile(@TempDir, "~", ".bmp") $out = FileSaveDialog('Save screenshot', '', '(*.bmp)',1+2,$s_FileName) _ScreenCapture_SaveImage($out, $scc) MsgBox(4096, "Info", "Names suitable for new temporary file : " & @LF & @LF & $s_FileName) My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Volgar Posted May 15, 2009 Author Share Posted May 15, 2009 Sorry, Yashied, it is so simple that I had not even thought Thank you! Link to comment Share on other sites More sharing options...
Volgar Posted May 15, 2009 Author Share Posted May 15, 2009 Another small question. Yashied, I found that you are the author of the script FTP library. Now, my challenge to upload a screenshot file to the server. I try to do so, but it did not send. What could be wrong? Thanks... expandcollapse popup#include <ScreenCapture.au3> #Include <File.au3> #Include <FTP.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $s_FileName = _TempFile(@TempDir, "www_", ".jpg") $out = FileSaveDialog('Save screenshot', '', '(*.jpg)',1+2,$s_FileName) _ScreenCapture_SaveImage($out, $scc) $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, $s_FileName) FileClose($file) const $Host = 'ftp:/222.122.3.333/test/' const $Login = 'sasasasa' const $Password = 'asdasdsad' local $hFtp, $hSession, $hFind, $tFind _FTP_Startup() $hFtp = _FTP_Open('MyFtp') $hSession = _FTP_Connect($hFtp, $Host, $Login, $Password) $tFind = DllStructCreate($tagWIN32_FIND_DATA) $hFind = _FTP_FileFindFirst($hSession, '', $tFind) while not @error ConsoleWrite(DllStructGetData($tFind, $s_FileName) & @CR) _FTP_FileFindNext($hFind, $tFind) wend _FTP_FileFindClose($hFind) _FTP_Disconnect($hSession) _FTP_Close($hFtp) _FTP_Shutdown() Link to comment Share on other sites More sharing options...
Yashied Posted May 15, 2009 Share Posted May 15, 2009 Another small question. Yashied, I found that you are the author of the script FTP library. Now, my challenge to upload a screenshot file to the server. I try to do so, but it did not send. What could be wrong? Thanks... expandcollapse popup#include <ScreenCapture.au3> #Include <File.au3> #Include <FTP.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $s_FileName = _TempFile(@TempDir, "www_", ".jpg") $out = FileSaveDialog('Save screenshot', '', '(*.jpg)',1+2,$s_FileName) _ScreenCapture_SaveImage($out, $scc) $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, $s_FileName) FileClose($file) const $Host = 'ftp:/222.122.3.333/test/' const $Login = 'sasasasa' const $Password = 'asdasdsad' local $hFtp, $hSession, $hFind, $tFind _FTP_Startup() $hFtp = _FTP_Open('MyFtp') $hSession = _FTP_Connect($hFtp, $Host, $Login, $Password) $tFind = DllStructCreate($tagWIN32_FIND_DATA) $hFind = _FTP_FileFindFirst($hSession, '', $tFind) while not @error ConsoleWrite(DllStructGetData($tFind, $s_FileName) & @CR) _FTP_FileFindNext($hFind, $tFind) wend _FTP_FileFindClose($hFind) _FTP_Disconnect($hSession) _FTP_Close($hFtp) _FTP_Shutdown()What are you doing? You just pasted my example in your code, not even knowing how it works and what does! Do you think I am stupid to not see this? I have no desire to write your program for you. Here's how my FTP.au3 to work, then think for yourself. #include <ScreenCapture.au3> #Include <File.au3> #Include <FTP.au3> $scc = _ScreenCapture_Capture('', 0, 0, -1, -1, True);Capture all screen $out = FileSaveDialog('Save screenshot', '', '(*.jpg)', 1 + 2, _TempFile('', "www_", ".jpg")) _ScreenCapture_SaveImage($out, $scc) $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, $out) FileClose($file) const $Host = 'ftp:/222.122.3.333/test/' const $Login = 'sasasasa' const $Password = 'asdasdsad' Local $hFtp, $hSession _FTP_Startup() $hFtp = _FTP_Open('MyFtp') $hSession = _FTP_Connect($hFtp, $Host, $Login, $Password) _FTP_PutFile($hSession, $out, StringRegExpReplace($out, "^.*\\", "")) _FTP_Disconnect($hSession) _FTP_Close($hFtp) _FTP_Shutdown() My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Volgar Posted May 15, 2009 Author Share Posted May 15, 2009 I am very hurry. Now I have all clear. Thank you. 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