How can I take a screenshot of the current screen with a cicode function?
Parents
Former Member
Never tried, but how about this: http://proscada.ru/ctkbase.en/articles/q5166.html
FUNCTION capture_screen()
//Memory or Local variable defined in the project
counter=counter+1;
// Open the Trend page of the project
PageDisplay("Trend");
Sleep(1);
// Capture a screenshot of the trend page
SendKeys("Trend", "{prtsc}");
// Open Microsoft Paint application. Use Mode '6' if wnat the paint window Minimized
Exec("mspaint", 1);
Sleep(3);
// Paste the clipboard into Paint
SendKeys("untitled - Paint", "^(v)");
Sleep(1);
// Open the 'Save As' menu
SendKeys("untitled - Paint", "^(s)");
Sleep(1);
// Enter the name of the screenshot: image_<screenshot's number>
SendKeys("Save As", "image_" + IntToStr(counter));
Sleep(1);
// Change to the 'save as' field
SendKeys("Save As", "{tab}");
Sleep(1);
// Select 'JPG' as type
SendKeys("Save As", "j");
Sleep(1);
// Save the file
SendKeys("Save As", "{enter}");
Sleep(1);
// Close Paint
SendKeys("image_" + IntToStr(counter) + ".JPG - Paint", "%({f4})");
SleepMS(500);
// Go back to the last page displayed before screenshot
PageLast();
Never tried, but how about this: http://proscada.ru/ctkbase.en/articles/q5166.html
FUNCTION capture_screen()
//Memory or Local variable defined in the project
counter=counter+1;
// Open the Trend page of the project
PageDisplay("Trend");
Sleep(1);
// Capture a screenshot of the trend page
SendKeys("Trend", "{prtsc}");
// Open Microsoft Paint application. Use Mode '6' if wnat the paint window Minimized
Exec("mspaint", 1);
Sleep(3);
// Paste the clipboard into Paint
SendKeys("untitled - Paint", "^(v)");
Sleep(1);
// Open the 'Save As' menu
SendKeys("untitled - Paint", "^(s)");
Sleep(1);
// Enter the name of the screenshot: image_<screenshot's number>
SendKeys("Save As", "image_" + IntToStr(counter));
Sleep(1);
// Change to the 'save as' field
SendKeys("Save As", "{tab}");
Sleep(1);
// Select 'JPG' as type
SendKeys("Save As", "j");
Sleep(1);
// Save the file
SendKeys("Save As", "{enter}");
Sleep(1);
// Close Paint
SendKeys("image_" + IntToStr(counter) + ".JPG - Paint", "%({f4})");
SleepMS(500);
// Go back to the last page displayed before screenshot
PageLast();