Jump to content

Search the Community

Showing results for tags 'save'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • Forum FAQ
  • AutoIt


  • Community Calendar

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 16 results

  1. Hey there folks! Task: 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! Cheers!
  2. Hi, is it possible to export only the area "$idOutput" with the TEXT as a PNG? Thanks #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Example() Func Example() Local $hGUI = GUICreate("Test", 700, 700, -1, -1) Local $input1 = GUICtrlCreateInput("", 10, 10, 150, 20) Local $idButtonStart = GUICtrlCreateButton("Start", 200, 10, 50, 30) Local $idButtonClear = GUICtrlCreateButton("Clear", 260, 10, 50, 30) Local $idButtonExport = GUICtrlCreateButton("Export", 320, 10, 50, 30) Local $idOutput = GUICtrlCreateLabel("TEXT", 10, 50, 500, 500, BitOR($BS_PUSHLIKE, $SS_CENTER)) GUICtrlSetFont($idOutput, 45, 800, "", "Impact") GUISetState(@SW_SHOW, $hGUI) ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButtonStart $ContentInput1 = GUICtrlRead($input1) GUICtrlSetData($idOutput, $ContentInput1) Case $idButtonClear GUICtrlSetData($input1, "") GUICtrlSetData($idOutput, "") Case $idButtonExport EndSwitch WEnd GUIDelete($hGUI) Exit EndFunc ;==>Example
  3. I am new to AutoIT but I do use Sikuli. Decided to use AutoIT for this project as all the required can be created in an .exe file, does not need Java like Sikuli. Also which can be pushed to tool bar of Windows 10 desktop. Our users will interact with a client/server application and normally work on dual screen. The script needs to detect the c/s application from the dual screen, needs to do three mouse clicks based of image/pixel comparison, will need to wait till the click object is available and then finally take screen capture of the top 40 rows and save the .jpeg file to windows file share location. once the file save is completed, pop up message - the screen capture is completed. Then the users can do their regular work. Potentially other factor that will play are the screen resolution. Can anyone guide me to some relevant scripts already in the forum. In the meantime I am learning the basics of the tool. Appreciate feedback and any help George V
  4. Needed a way to store global temporary & permanent information and came up with this. This is inspired by NodeJS's store and store2 packages, as well as W3 specs' localStorage and sessionStorage, offering multiple ways of usage. This is not related to any browser's storage, nor will allow you to access or modify browsers storage - although this is possible and not a hard task, this is not what this UDF is intended to do. This UDF offers functions for temporary storage (that gets cleaned up once the application is shutdown) that is kept on memory using ScriptingDictionary, as well as for permanent storage, that is saved on the harddisk as an encrypted file. sessionStorage (temporary storage) It's useful to keep application state and temporary settings accessible by any part of your script (although it could also be done with a global variable, I still prefer this method). You have multiple ways, at your choice, to: ; add or modify a key sessionStorage("foo", "bar") store("foo", "bar") sessionStorage_set("foo", "bar") sessionStorage_setItem("foo", "bar") ; read a key (returns false if key does not exist) $read = sessionStorage("foo") $read = store("foo") $read = sessionStorage_get("foo") $read = sessionStorage_getItem("foo") ; delete a key sessionStorage_remove("foo") ; delete all keys sessionStorage_clear() sessionStorage_clearAll() localStorage (permanent storage) It's useful to store user-defined settings. ; initialize ; this is optional, but allows you to control ; how things are going to be saved localStorage_startup([file where you want the settings to be saved], [crypt password]) ; by default, if not supplied, if supplied the "Default" keyword (or if you dont initialize), ; the file will be a random-named file (based on @ScriptFullPath) at user's %APPDATA% ; and the password will also be based on @ScriptFullPath ; you can set only the crypt password if you want: ; localStorage_startup(Default, "mypassword") ; the usage is the same as sessionStorage ; add or modify a key localStorage("foo", "bar") store2("foo", "bar") ; notice the '2' localStorage_set("foo", "bar") localStorage_setItem("foo", "bar") ; read a key (returns false if key does not exist) $read = localStorage("foo") $read = store2("foo") $read = localStorage_get("foo") $read = localStorage_getItem("foo") ; delete a key localStorage_remove("foo") ; delete all keys localStorage_clear() localStorage_clearAll() Download
  5. This small UDF helps you save any text to speech to a .wav file. UDF: #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include-once ; #INDEX# ======================================================================================================================= ; Title .........: _TTStoWav() ; AutoIt Version : ; Language ......: English ; Author(s) .....: natedog102 ; Modifiers .....: ; Forum link ....: https://www.autoitscript.com/forum/topic/191573-tts-text-to-speech-to-wav-file-using-sapi/ ; Description ...: TTS to .wav file using SAPI ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _TTStoWav ; Description ...: TTS to .wav file using SAPI ; Syntax.........: _TTStoWav($sText, $sLocation[, $iRate = 1[, $iVolume = 100]]) ; Parameters ....: $sText - String you want converted to a .wav ; $sLocation - Save location + file name, example: "C:\folder\sample.wav" ; $iRate - TTS speak rate between -10 and 10 ; $iVolume - Volume of the TTS between 0 and 100 ; Return values .: Success - Returns one ; Failure - Returns zero ; Author ........: natedog102 ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TTStoWav($sText, $sLocation, $iRate = 1, $iVolume = 100) $oFileStream = ObjCreate("SAPI.SpFileStream") If @error Then Return 0 EndIf $oFileStream.Format.Type = 39 $oFileStream.Open($sLocation, 3) $oSpeech = ObjCreate('SAPI.SpVoice') If @error Then Return 0 EndIf $oSpeech.AudioOutputStream = $oFileStream $oSpeech.Rate = $iRate $oSpeech.Volume = $iVolume $oSpeech.Speak($sText, 3) $oSpeech.WaitUntilDone(10000) $oFileStream.Close() Return 1 EndFunc ;==>_TTStoWav And here's example usage: _TTStoWav("This is a test", "C:\folder-must-exist\sample2.wav") I have never made a UDF before so I don't know if I coded it correctly or if I followed all the recommended guidelines. Apologies if I haven't. DOWNLOAD: _TTStoWav.au3
  6. Local $count = 1 Local $x1= 100,$y1 = 100,$x2 = 110,$y2 = 110 $area = ($x2+$x1)*($y2+$y1) Local $array[$area][2] For $i = $x1 to $x2 Step 1 For $j = $y1 to $y2 Step 1 $color = PixelGetColor($i,$j) $scolor = Hex($color,6) $array[$count][2] = [$scolor,1] $position = _ArraySearch($array,$scolor,0,0,0,0,1) If $array[$position][0] = $scolor Then $array[$position][1] +=1 Else $count += 1 EndIf Next Next _ArrayDisplay($array) plz help adjust and shrink it down soo confusing playing with array
  7. 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")
  8. 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 ?
  9. 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
  10. I want to save some tests (about one thousand tests totally) from a quiz website to a text file. The test page is a simple one, it contains: 1) The questions; they are inside the <p class="qw">...</p> 2) 5 choices; they are radio buttons id ="a1", "b1" ... When I click a radio for a choice, if correct, the background of it will turn green, if wrong, it will turn red, and the correct answer will turn green. What I need to get is the correct answer. So when I click an answer, no matter right or wrong, the test will automatically go to the next question in about 3 or 4 seconds (I don't know exactly how many seconds). So what I want to save is: Questions choice 1; choice 2; choice 3; choice 4; choice 5; correct answer Then next question... I have limited knowledge of AutoIt, I have check the IE UDFs, but I don't know where to start. Especially I don't know how to do since the test will to go next item automatically. Please give me some hints. Thank you very much.
  11. Ciao 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 Thanks Marco
  12. In my GUI after doing multiple actions I am saving the output to a file by using a save button in GUI. And another is "save to Clipboard" When I click the save button the file is saving fine but the GUI is freezing and we are try to do any other usage on it. And in task manager, the AutoIt3_x64.exe CPU usage is showing as 99%. Can anyone help on this.
  13. Hello Auto IT I wanna keep it short, so let's get started. I like to store my account details for various sites and programs on a simple log file, It's personal preference and I know it's risky. I'm using somewhat a "form" when I'm typing in my accounts, so that It's easier for me to keep track on what site/program the account is for. The form looks somewhat like this: Would it be possible to create a script in which makes a UI where i can type in those fields, and it will automaticly add it to my log file? I would love to know how this could work, and what kind commands i should look into. - AliOzturk
  14. Background My desktop icons shift around often when I extend my screen or connect a higher resolution monitor to my laptop, or when a game crashes in an awkward resolution. Recently I've not been having very much luck with programs and scripts that save desktop icon positions. I know there are various examples on this forum - but I've been frustrated by them as well as other options (eg: an outdated layout.dll shell extension) For the record, I use Windows 7 64-bit ; I haven't tested this on anything else, but that was probably part of the problem. From some research it appears desktop positions can be saved in one of several different registry keys; older programs may not be searching for them all. So, I decided to write my own crappy program that *did* search multiple locations for position settings. TL;DR Made a program to save desktop icon positions; checks for multiple settings before attempting. Sauce Anyway, here's my badly-informed bug-ridden spaghetti code that does what I need: Note: See slightly cleaned-up code in a reply below! #RequireAdmin #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Array.au3> Global $results[11];elements are array[5]= 0:$display_name 1:$bag_key 2:$bag 3:$valueName 4:$valueDisplayName Global $ctrls[11][5] Global $selected = Int(IniRead("itempos.ini", "settings", "selected", -1)) Global $uiOps = GUICreate("Desktop Position Options", 350 + 20, 100) Global $txSel = GUICtrlCreateInput("Not Selected", 0, 0, 350, 20, $ES_READONLY) Global $btSel = GUICtrlCreateButton("...", 350, 0, 20, 20) Global $btSav = GUICtrlCreateButton("Save", 0, 20, 350 + 20, 40) Global $btRes = GUICtrlCreateButton("Restore", 0, 60, 350 + 20, 40) uiResetOptions() Global $uiSel, $btRef Local $hadSettings = load() uiPopulate($results, $ctrls, $uiSel, $btRef, (Not $hadSettings));refresh if didn't cache settings GUISetState(@SW_SHOW, $uiOps) If (Not $hadSettings) Or $selected < 1 Then GUISetState(@SW_SHOW, $uiSel) WinActivate($uiSel) Else GUISetState(@SW_HIDE, $uiSel) WinActivate($uiOps) EndIf ;------------------------------------ While 1 $amsg = GUIGetMsg(1) $msg = $amsg[0] Switch $msg Case $GUI_EVENT_CLOSE If $amsg[1] = $uiOps Then Quit() GUISetState(@SW_HIDE, $uiSel) WinActivate($uiOps) Case $btRef uiPopulate($results, $ctrls, $uiSel, $btRef) ContinueCase Case $btSel GUISetState(@SW_SHOW, $uiSel) WinActivate($uiSel) Case $btSav save() uiResetOptions() Case $btRes restore() uiResetOptions() Case $ctrls[0][0] MsgBox(0, "Position Information Locations", "This window lists system icon position settings" & @CRLF & "This selection may help if restoring settings does not work. If you do not know what to select, try `Current User`. ") EndSwitch For $n = 1 To 10 If $msg = $ctrls[$n][0] And $ctrls[$n][0] <> 0 Then uiSelect($n) ExitLoop EndIf Next WEnd ;------------------------ Func load() Global $selected Global $results Local $hadSettings = False For $i = 0 To 10 Local $entry[5] If IniRead("itempos.ini", "cache", $i, "") = "array" Then For $j = 0 To 4 $entry[$j] = IniRead("itempos.ini", "cache", $i & '_' & $j, "") Next $results[$i] = $entry $hadSettings = True Else $results[$i] = IniRead("itempos.ini", "cache", $i, "") EndIf Next Local $n = Int(IniRead("itempos.ini", "settings", "selected", -1)) If Not $hadSettings Then $n = -1 uiSelect($n) Return $hadSettings EndFunc ;==>load Func Quit() IniWrite("itempos.ini", "settings", "selected", $selected) For $i = 0 To 10 Local $entry = $results[$i] If IsArray($entry) Then IniWrite("itempos.ini", "cache", $i, "array") For $j = 0 To 4 IniWrite("itempos.ini", "cache", $i & '_' & $j, $entry[$j]) Next Else IniWrite("itempos.ini", "cache", $i, $entry) EndIf Next Exit EndFunc ;==>quit Func uiResetOptions() If $selected > 0 Then GUICtrlSetState($btSav, $GUI_ENABLE) If isSaved() Then GUICtrlSetState($btRes, $GUI_ENABLE) Else GUICtrlSetState($btRes, $GUI_DISABLE) EndIf Else GUICtrlSetState($btSav, $GUI_DISABLE) GUICtrlSetState($btRes, $GUI_DISABLE) EndIf EndFunc ;==>uiResetOptions Func isSaved() Local $entry = $results[$selected] If Not IsArray($entry) Then Return False Return StringLen(IniRead("itempos.ini", safename($entry[0] & '-' & $entry[2] & '-' & $entry[4]), safename($entry[3]), "")) > 0 EndFunc ;==>isSaved Func save() GUICtrlSetState($btSav, $GUI_DISABLE) GUICtrlSetState($btRes, $GUI_DISABLE) WinActivate("Program Manager") Sleep(250) Send("{F5}") Sleep(1000) WinActivate($uiOps) Local $entry = $results[$selected] Local $nameSafe = safename($entry[0] & '-' & $entry[2] & '-' & $entry[4]) Local $bag_key = $entry[1] Local $valueName = $entry[3] Local $valueNameSafe = safename($valueName) Local $value = RegRead($bag_key, $valueName) ConsoleWrite("Saving to " & $nameSafe & @CRLF) IniWrite("itempos.ini", $nameSafe, $valueNameSafe, $value) EndFunc ;==>save Func restore() Local $entry = $results[$selected] Local $nameSafe = safename($entry[0] & '-' & $entry[2] & '-' & $entry[4]) Local $bag_key = $entry[1] Local $valueName = $entry[3] Local $valueNameSafe = safename($valueName) Local $value = IniRead("itempos.ini", $nameSafe, $valueNameSafe, "") ConsoleWrite("Restoring from " & $nameSafe & @CRLF) If StringLen($value) = 0 Then Return MsgBox(0, 'Restore Error', "No data is available for this entry to be restored.") ProcessKill('explorer.exe') ProcessWaitClose('explorer.exe') RegWrite($bag_key, $valueName, "REG_BINARY", Binary($value)) Run('explorer.exe') EndFunc ;==>restore ;-------------------------------------------------- Func uiSelect($n) Global $selected Global $results $selected = $n Local $entry = "" If $selected > 0 Then $entry = $results[$n] If IsArray($entry) Then GUICtrlSetData($txSel, $entry[0] & '-' & $entry[2] & '-' & $entry[4]) If IsHWnd($uiSel) Then GUISetState(@SW_HIDE, $uiSel) WinActivate($uiOps) uiResetOptions() Return True Else GUICtrlSetData($txSel, "Nothing Selected") uiResetOptions() If IsHWnd($uiSel) Then GUISetState(@SW_SHOW, $uiSel) WinActivate($uiSel) EndIf Return False EndFunc ;==>uiSelect Func uiPopulate(ByRef $results, ByRef $ctrls, ByRef $ui, ByRef $button, $doRefresh = True) ;results and ctrls must have the same UBound. ProgressOn("Refreshing...", "Refreshing...") ProgressSet(1, "Cleaning up...") Sleep(250) Local $x = UBound($ctrls) - 1 GUISwitch($ui) GUICtrlDelete($button) For $n = 0 To $x For $i = 0 To 3 If $ctrls[$n][$i] Then GUICtrlDelete($ctrls[$n][$i]) Next Next If IsHWnd($ui) Then GUIDelete($ui) If $doRefresh Then For $i = 0 To UBound($results) - 1 $results[$i] = '' Next ProgressSet(5, "Finding folder information sources...") searchhive($results) EndIf ProgressSet(95, "Creating User Interface...") Sleep(250) Local $count = 0 For $n = 1 To $x Local $y = ($n - 1) * 20 If IsArray($results[$n]) Then $count += 1 Next $ui = GUICreate("Select system setting to use...", 450, 20 * ($count + 2) + 10) $ctrls[0][0] = GUICtrlCreateButton("??", 0, 0, 20, 20) $ctrls[0][1] = GUICtrlCreateLabel("Profile", 020, 5, 250, 20) $ctrls[0][2] = GUICtrlCreateLabel("Bag", 270, 5, 050, 20) $ctrls[0][3] = GUICtrlCreateLabel("ItemPos", 320, 5, 150, 20) $ctrls[0][4] = GUICtrlCreateLabel("-----------------------------------", 0, 20, 450, 5, $SS_ETCHEDHORZ) $count = 0 For $n = 1 To $x Local $y = $n * 20 + 5 Local $entry = $results[$n] If IsArray($entry) Then $count += 1 $ctrls[$n][0] = GUICtrlCreateButton($count & '.', 0, $y, 20, 20) $y += 5 $ctrls[$n][1] = GUICtrlCreateLabel($entry[0], 020, $y, 250, 20) $ctrls[$n][2] = GUICtrlCreateLabel($entry[2], 270, $y, 050, 20) $ctrls[$n][3] = GUICtrlCreateLabel($entry[4], 320, $y, 150, 20) EndIf Next $ctrls[$x][4] = GUICtrlCreateButton("Refresh", 0, 20 * ($count + 1) + 10, 450, 20) $button = $ctrls[$x][4] GUISwitch($ui) ProgressSet(100, "Showing off...") Sleep(250) ProgressOff() Return $ui EndFunc ;==>uiPopulate ;-------------------------------------------------------------------- Func searchhive(ByRef $results) ;ConsoleWrite('Current'&@CRLF) ProgressInitial(5) searchuser($results, 'HKEY_CURRENT_USER', 'Current User') ProgressSet(25) For $i = 1 To 9999 Local $u = RegEnumKey("HKEY_USERS\", $i) If @error <> 0 Then ExitLoop ;ConsoleWrite($u&@CRLF) searchuser($results, "HKEY_USERS\" & $u, $u) ProgressSet(25 + $i * 10) Next EndFunc ;==>searchhive Func searchuser(ByRef $results, $user_key, $display_name) Local $software_key[2] = ["Software\Microsoft\Windows", "Software\Classes\Local Settings\Software\Microsoft\Windows"] Local $shell_key[2] = ["Shell", "ShellNoRoam"] Local $name_suffix For $sw In $software_key $name_suffix = "" If StringInStr($sw, "Local") Then $name_suffix = "L" For $shell In $shell_key If StringInStr($shell, "NoRoam") Then $name_suffix &= "NR" Local $bags_key = $user_key & "\" & $sw & "\" & $shell & "\Bags" For $i = 1 To 9999 ProgressIncrement(0.01) Local $bag = RegEnumKey($bags_key, $i) If @error <> 0 Then ExitLoop If StringLen($name_suffix) > 0 Then $name_suffix = "(" & $name_suffix & ")" searchbag($results, $bags_key, $bag, $display_name & $name_suffix) Next Next Next EndFunc ;==>searchuser Func searchbag(ByRef $results, $bags_key, $bag, $display_name) Local $bag_key = $bags_key & '\' & $bag & '\Shell' For $i = 1 To 9999 Local $value = RegEnumVal($bag_key, $i) If @error <> 0 Then ExitLoop If StringInStr($value, 'ItemPos') Then Local $entry[5] = [$display_name, $bag_key, $bag, $value, StringTrimLeft($value, 7)] _Array_Fixed_Push($results, $entry) EndIf Next $bag_key = $bags_key & '\' & $bag & '\Desktop' For $i = 1 To 9999 Local $value = RegEnumVal($bag_key, $i) If @error <> 0 Then ExitLoop ;ConsoleWrite($value&@CRLF) If StringInStr($value, 'ItemPos') Then Local $entry[5] = [$display_name, $bag_key, $bag, $value, StringTrimLeft($value, 7)] _Array_Fixed_Push($results, $entry) EndIf Next EndFunc ;==>searchbag Func _Array_Fixed_Push(ByRef $array, $value);adds an item, overwriting the oldest item | NOTE: Edited from original intent, see comments Local $x = UBound($array) - 1 If $array[0] = $x Then Return False; *** decided later that overwriting sucked for systems with many profiles. Local $i = Mod($array[0], $x); values from 0 to x-1 Local $n = $i + 1;(0 to x-1)+1 = 1 to x $array[0] = $n; this is also the nonadjusted index for the next item :) $array[$n] = $value EndFunc ;==>_Array_Fixed_Push Func ProgressInitial($n = 0) Global $ProgressIncrement $ProgressIncrement = $n ProgressSet($n) EndFunc ;==>ProgressInitial Func ProgressIncrement($n = 1) Global $ProgressIncrement $ProgressIncrement += $n ProgressSet($ProgressIncrement) EndFunc ;==>ProgressIncrement Func safename($s) Return StringRegExpReplace($s, "[^a-zA-Z0-9_\-]", "_") EndFunc ;==>safename Func ProcessKill($p); I should probably credit someone for this function $Kernel32 = DllOpen("kernel32.dll") $hproc = DllCall($Kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', True, 'int', ProcessExists($p)) DllCall($Kernel32, "int", "TerminateProcess", "int", $hproc[0], "dword", 1) DllClose($Kernel32) EndFunc ;==>ProcessKill Other Notes This only scans for settings/prompts you on the first run, it should keep that information for the next run. It also limits you to using one of the first 10 profiles the scan results in. Sorry about having to kill/restart explorer when restoring positions - nothing else worked for me. Clarification for the ItemPos text: from what I've read, it is <Resolution>(<Monitor>). I'm unsure how settings behave when you have icons dragged from one screen to the next and restore one of the screens.
  15. _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrush) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("OCR A Extended") $hFont = _GDIPlus_FontCreate($hFamily, $FontSize, 0) $tLayout = _GDIPlus_RectFCreate(10, 10, 0, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) $hBrush = _GDIPlus_BrushCreateSolid(0xFF37FF00) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject($hBitmap) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $TempImg = _TempFile(@ScriptDir, "", ".png") _GDIPlus_ImageSaveToFile($hImage, $TempImg) $NewImage = FileRead($TempImage) I'd like to get rid of this $TempImg = _TempFile(@ScriptDir, "", ".png") _GDIPlus_ImageSaveToFile($hImage, $TempImg) $NewImage = FileRead($TempImage) For example, I'm looking to encode the image object from bmp (as I think it is) to PNG, jpg, jpeg, tiff etc without actually having to save the image to the hard drive and then re-reading it to memory. I've failed to locate anything like this on the forums...
  16. Hello everyone, I need a little help if you can. Im making a small script which sends a Refresh command, "{F5}" to my browser when I save a file in Notepad++. I work as web developer and I need this to save my time by automating the process, so when I "Save" a .PHP file in Notepad++, the script activates the browser window and sends a Refresh command to update changes on web page. If WinExists ("[CLASS:MozillaWindowClass;]", "") Then WinActivate("[CLASS:MozillaWindowClass;]"); Send("{F5}"); EndIf Is there any way I can detect when the file is saved? Or when I press CTRL+S? Thanks.
  • Create New...