snowcake Posted July 29, 2016 Share Posted July 29, 2016 Hi I am a new learner I need ScreenCapture server's computer name and save the picture to what folder i need I try many ways it's not works Thanks for example Server name : ELB12036 path : \\fs02\eng\ file name : server_name.jpg #include <ScreenCapture.au3> Example() $Server @computername $path = "\\fs02\eng\" Func Example() ; Capture full screen _ScreenCapture_Capture($path & $Server & ".jpg") EndFunc ;==>Example Link to comment Share on other sites More sharing options...
CygnusX1 Posted July 29, 2016 Share Posted July 29, 2016 (edited) Shouldn't it be $Server = @computername instead of $Server @computername And you declared your variables below the call to the function. The variables are never being seen in the Example() Try $Server= @computername $path = "\\fs02\eng\" Example() Func Example() ; Capture full screen _ScreenCapture_Capture($path & $Server & ".jpg") EndFunc ;==>Example Edited July 29, 2016 by CygnusX1 Cygnus Link to comment Share on other sites More sharing options...
JohnOne Posted July 29, 2016 Share Posted July 29, 2016 First, "it's not works" is not good enough, elaborate. Second, Full path and extension of the image file AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
AutoBert Posted July 30, 2016 Share Posted July 30, 2016 Your script isn't runable: >Running AU3Check (3.3.14.2) from:C:\Program Files\AutoIt3 input:C:\Users\Bert\AutoIt3.My\Temp\test.au3 "C:\Users\Bert\AutoIt3.My\Temp\test.au3"(7,9) : warning: $Server: possibly used before declaration. $Server @computername ~~~~~~~~^ "C:\Users\Bert\AutoIt3.My\Temp\test.au3"(7,9) : error: Statement cannot be just an expression. $Server @computername ~~~~~~~~^ "C:\Users\Bert\AutoIt3.My\Temp\test.au3"(7,22) : error: Statement cannot be just an expression. $Server @computername ~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Bert\AutoIt3.My\Temp\test.au3"(7,9) : error: $Server: undeclared global variable. $Server @computername ~~~~~~~~^ C:\Users\Bert\AutoIt3.My\Temp\test.au3 - 3 error(s), 1 warning(s) !>04:46:18 AU3Check ended. Press F4 to jump to next error.rc:2 so try this one: #include <ScreenCapture.au3> Example() $Server=@computername $path = "\\fs02\eng\" Func Example() ; Capture full screen ConsoleWrite('Filepath: '&$path & $Server & ".jpg"&@CRLF) _ScreenCapture_Capture($path & $Server & ".jpg") EndFunc ;==>Example Link to comment Share on other sites More sharing options...
snowcake Posted July 30, 2016 Author Share Posted July 30, 2016 I try a new script #include <ScreenCapture.au3> Example() $Server = @computername $path = "C:\autoit-v3-setup\Examples\Ting" msgbox(4096,'test',$path) Func Example() ; Capture full screen ConsoleWrite('Filepath: '&$path & $Server & ".jpg"&@CRLF) _ScreenCapture_Capture($path & $Server & ".jpg") EndFunc ;==>Example error again --------------------------- AutoIt Error --------------------------- Line 14 (File "C:\autoit-v3-setup\Examples\Ting\test.au3"): _ScreenCapture_Capture($path & $Server & ".jpg") _ScreenCapture_Capture(^ ERROR Error: Variable used without being declared. --------------------------- 確定 --------------------------- Link to comment Share on other sites More sharing options...
Loken Posted July 30, 2016 Share Posted July 30, 2016 (edited) #include <ScreenCapture.au3> $Server = @computername $path = "C:\autoit-v3-setup\Examples\Ting" Example() msgbox(4096,'test',$path) Func Example() ; Capture full screen ConsoleWrite('Filepath: '&$path & $Server & ".jpg"&@CRLF) _ScreenCapture_Capture($path & $Server & ".jpg") EndFunc ;==>Example You are using $Server and $Path variables into Exmaple function. And you are trying to call Example function before define the variables. lol Edited July 30, 2016 by Loken snowcake 1 Link to comment Share on other sites More sharing options...
snowcake Posted July 31, 2016 Author Share Posted July 31, 2016 Dear Loken thanks so much no error msg but No Picture I think maybe the reason is the windows os embedded in ma Link to comment Share on other sites More sharing options...
SadBunny Posted July 31, 2016 Share Posted July 31, 2016 Script works fine for me. You do realize your file will be stored as follows (assuming your computername to be MyComputer)? C:\autoit-v3-setup\Examples\TingMyComputer.jpg Not sure if that is your intention. I get the feeling that maybe you intended to put another backslash after the path? Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Loken Posted July 31, 2016 Share Posted July 31, 2016 Please try this; #include <ScreenCapture.au3> $Server = @computername $path = FileSelectFolder("Choose a folder to save your image", @DesktopDir) $path &= "\Ting " Example() msgbox(4096,'test',$path) Func Example() ; Capture full screen ConsoleWrite('Filepath: '&$path & $Server & ".jpg"&@CRLF) _ScreenCapture_Capture($path & $Server & ".jpg") EndFunc ;==>Example Link to comment Share on other sites More sharing options...
guinness Posted July 31, 2016 Share Posted July 31, 2016 Please pay attention to the output error messages, they are pretty clear as to what is the problem. "A variable not being declared" is pretty descriptive even for a non-techie, plus Google Translate should be able to translate this without any problems. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
snowcake Posted August 1, 2016 Author Share Posted August 1, 2016 It's works thanks so much.. guinness: I am trying to learn how to see the output error msg.. 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