3 posts in this topic
I've created a simple script that opens the Snipping Tool; Selects the "Full Screen Snip" option; then closes the program, prompting a save. What I can't figure is how to name the file using the system date and time.
Can anyone help?
Run(@WindowsDir & '\system32\SnippingTool.exe') AutoItSetOption('MouseCoordMode', 0) Sleep(1) $hWnd= WinWait("Snipping Tool", "ToolBarWindow32", 1) WinActive($hWnd) MouseClick('primary', 84, 48, 1, 0) MouseClick('primary', 84, 140, 1, 0) WinClose("[Class:Microsoft-Windows-Tablet-SnipperEditor]") ControlClick("Snipping Tool", "", "Button1")
Hey there folks!
I have an array of DllStructs, created with the function DllStructCreate. Let's call the array $structs. This $structs contains important information for the program. I want to save my $structs variable for future use in a file (i.e.: the user closes the program, opens it again and has the option to load a file). I want to load files which contain a $structs variable, and let the program work with this "loaded" variable. Questions:
Since I have never done such a thing (saving/loading a file, possibly in a different format from txt or ini), I'd like to know:
Is this possible? Is my only option to save my $structs in text format? That would require a function which receives a file and interprets the text it has, creating a new $structs with the info it's getting from the file. (I think this could lead to trouble) I'm worried about security. Since the program will be loading files, I don't want it to crash because the user decided to give it modified files. Is it possible to create a file that's readonly for the user? That would prevent some tampering with the file. From what I've been reading, I have several functions available for File management, namely FileOpen, FileRead and FileWrite. In a first glance, these appear to be the only functions I need. Do I need more?
Thank you for your time!
Hi, i have some sort of problem here, from a website i can download a xls file, it is 180kb, when i open it with excel and then save it (without changing anything), the file is 130kb.
Is there a possibility to resave a xls file, without opening excel to do it ?
Hi! I am using a simple function to put a watermark into another image. It works very well, but if then I try to delete the source image file (in the script below it is called $sFile) I have the error that the file is open in my process. Thanks in advance and sorry for my bad english.
Func _Watermark($sFile2, $sFile, $sLogo) Local $hImage1, $hImage2, $hGraphic _GDIPlus_Startup () $hImage1 = _GDIPlus_ImageLoadFromFile ($sFile) ; image $X1 = _GDIPlus_ImageGetWidth ($hImage1) $Y1 = _GDIPlus_ImageGetHeight ($hImage1) $hImage2 = _GDIPlus_ImageLoadFromFile ($sLogo) ; logo $X2 = _GDIPlus_ImageGetWidth ($hImage2) $Y2 = _GDIPlus_ImageGetHeight ($hImage2) $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1) _GDIPlus_GraphicsDrawImage ($hGraphic, $hImage2, $X1-$X2-5, 5) _GDIPlus_ImageSaveToFile ($hImage1, $sFile2) ; image watermarked _GDIPlus_ImageDispose ($hImage1) _GDIPlus_ImageDispose ($hImage2) _GDIPlus_ShutDown () EndFunc ;==>_Watermark
I need to save a file with ISO 8859-1 encoding
Now my script is:
$contenuti_header = "Configuration file <> O:\test.txt <> Last update: 28/09/2015 09:46:36 ð ñ" $record_part1 = "ò1ò0ò1òLayer_01ïï1ï0ï0ï0ï0ï0ï0ïï0ï255ï0ï0ï0ï255ï255ï125ï0ï0ï3ï0ï0ï0ï0ï0ï0ï0ï0ï0ï3ï150ï5ï102ï82ï10ï4ï0ï0ïTahoma;16777215;22;1;ï0ï0ï0ïïïï0ï0ï33ï500ï200ï4ï1ï720ï10ï5ï100ï63ï300ï850ï16777215ï0ï0ï0ï0ï0ï0ï0ï0ï0ï0ï" $record_part2 ="ï0ïTahoma;16777215;22;1;ïïhh.nnïïï0ïï0ï0ï0ï4ï65793ï255ï0ï2ï0ï0ïï5ï5ï0ï0ï0ï0ï0ï100ï100ï0ï0ï8421504ï16777215ïïï0ï0ïïï0ï720ï576ï0ï0ï0ï0ï0ï0ï0ï0ï2ï0ï6ï0ï0ï1ï0ï1ï0ï0ïîò0ò0òòòòòòó" for $i = 1 to $num $contenuti_record = $record_part1 & "ò" & $num & $record_part2 Next $contenuti_end = "òòòòòòòòòòòòòó" $fileTemplate = FileOpen("O:\file.txt", 2) FileWrite($fileTemplate, $contenuti_header&$contenuti_record&$contenuti_end) FileClose($fileTemplate) Autoit writes the file with UTF-8 encoding but the programs that read that file can't read it correctly. If I open file.txt with SublimeText and save it with ISO 8859-1 encoding, the program works well