Jump to content

About ScreenCapture.au3


Recommended Posts

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

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 by CygnusX1

Cygnus

Link to comment
Share on other sites

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

 
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

#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 by Loken
Link to comment
Share on other sites

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

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

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...