Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/26/2017 in all areas

  1. You don't need to read the whole file in a string and you don't need to open the file two times (one for read, one for write). This should be more efficient: Global $s_FilePath = "C:\Test.txt" Global $s_EndChars = @CRLF Global $hFile = FileOpen($s_FilePath, 1) FileSetPos($hFile, -StringLen($s_EndChars), 1) If FileRead($hFile) <> $s_EndChars Then FileWrite($hFile, $s_EndChars) FileClose($hFile)
    2 points
  2. guinness

    AutoIt3 Portable

    I drew inspiration from a similar Script/Program Creator made, for designing a Portable version of the SciTE4AutoIt3 bundled with the AutoIt3 package. Note: The problem with the previous Script/Program was it wasn't 100% Portable, it left files in the %APPDATA% folder, which was due to the session save feature of SciTe. So I modified the Script/Program and added parameters to check if SciTe was running and if the appropriate configuration files existed. Download: http://softwarespot.wordpress.com/code/autoit-portable/
    1 point
  3. Map implementation of Hashtable. https://msdn.microsoft.com/en-us/library/system.collections.hashtable(v=vs.110).aspx Func _Example() Local $oAssembly = _CLR_LoadLibrary("mscorlib") ConsoleWrite("!$oAssembly: " & IsObj($oAssembly) & @CRLF) Local $oClouds = _CRL_CreateObject($oAssembly, "System.Collections.Hashtable") ConsoleWrite("!$oHash: " & IsObj($oClouds) & @CRLF) $oClouds.Add("Cirrus", "Castellanus"); $oClouds.Add("Cirrocumulus", "Stratiformis"); $oClouds.Add("Altostratus", "Radiatus"); $oClouds.Add("Stratocumulus", "Perlucidus"); $oClouds.Add("Stratus", "Fractus"); $oClouds.Add("Nimbostratus", "Pannus"); $oClouds.Add("Cumulus", "Humilis"); $oClouds.Add("Cumulonimbus", "Incus"); local $iCloudCount=$oClouds.count consolewrite("Clouds added " & $iCloudCount & @CRLF) consolewrite("It contains Fractus " & $oClouds.containsvalue("Fractus") & @CRLF) EndFunc ;==>_Example
    1 point
  4. It should work using this expression (untested) StringRegExpReplace($text, '(?=\z)', @crlf)
    1 point
  5. By the way: Do you now also understand why it went into this indefinite loop? My guess is that the mentioned Run("Cygnus CP Config GUI_V_02_02_13_setup") command would re-shell itself since it could interpret the first word as the program and the rest as parameters. That is why I suggested to change the name from Cygnus.exe to something totally different. Jos
    1 point
  6. Seems you have missed our forum rules which explicitly prohibit game automation discussions. Please take the opportunity now to read them. Jos
    1 point
  7. water

    Need Help with a Script

    There is an example in the code snippet section of the wiki: https://www.autoitscript.com/wiki/AutoIt_Snippets#IsInternetConnected
    1 point
  8. The reason it doesn't work is because the file does not end with a line break character of any kind. The code above is intended to convert single line break characters to the combination CR and LF. This works fine with your example. Local $hFile = FileOpen("C:\Users\user\Desktop\Testo.txt") Local $sText = FileRead($hFile) FileClose($hFile) If StringRight($sText, 2) <> @CRLF Then $hFile = FileOpen("C:\Users\user\Desktop\Testo.txt", 1) FileWrite($hFile, @CRLF) FileClose($hFile) EndIf You may want to used both methods: converting single characters (as shown by guinness and mikell) and adding an extra CRLF at the end if need be.
    1 point
  9. Hello. You're structure is wrong. youre missing fields. https://msdn.microsoft.com/ru-ru/library/windows/desktop/aa377274(v=vs.85).aspx Saludos
    1 point
  10. Hello Here is a small UDF wrapper(It's pretty funny to call it UDF. it's more a start to build one) It need to be clean add error checking remove comments create functions help etc.. etc......... But I really don't have enough time to do it maybe someone can do it. Evething is gathered from previous codes. I added some examples all in a zip. CLR.zip Updated-1: CLR.zip Updated-2: CLR.zip Updated-3 CLR.zip Examples: ;~ _Example1() ;C# & VB Messagebox ;~ _Example2() ;C# Create Executable ;~ _Example3() ;C#Return String from Class Method ;~ _Example4() ;XPTable Example ;~ _Example5() ;A MessageBox Using System.Windows.Forms.MessageBox ;~ _Example6() ;WebClient.DownloadString Using System.Net.WebClient ;~ _Example7() ;Form Using System.Windows.Forms.Form ;~ _Example8() ;Stack Using System.Collections.Generic.Stack ;~ _Example9() ;File.ReadAllText Using System.IO ;~ _Example10() ;ArrayList Using System.Collections.ArrayList Saludos
    1 point
  11. I'd use _WinAPI_IsInternetConnected() Instead of ping
    1 point
  12. Yes. Ingredients : While loop + If/Then/Else condition + Ping function (all in the helpfile)
    1 point
  13. I will do my very best
    1 point
  14. To clarify a bit more, ProcessExists() can use a PID (a unique Process ID) or a process name (ex. notepad.exe) to identify the program. WinExists can use a handle (unique hex value of a window, like the AutoIt SciTe editor), the window title, or class. You can have multiple processes with the same name (i.e., you can run however many notepad.exe programs as you want) and windows can have the same title and class (i.e., if you open 10 notepads all of them will start out with the title Untitled - Notepad). It all depends on what you're trying to make your script do. It would be more beneficial to use ProcessExists if you're trying to monitor programs you started in your script using Run or ShellExecute, as they both return the PID of the process it starts (So no need to look for the handle). On the other hand most programs have their own unique titles so you don't need to worry about the handles if you don't start them. I've used process exists in a program, I started a while back, where I was downloading lots of files. Instead of having the main script download them I had it split all the urls into batches (so if I had 30 things to download, make 3 strings with 10 urls in each) and then start a script that takes the long string of urls as a parameter, splits them, and downloads them for me. My main script doesn't get interrupted waiting for InetGet to download everything and it just monitored the PID returned from Run.
    1 point
  15. When you use Ctrl Alt Delete to bring up the TaskManager, you can view processes that are runnng on your machine, many don't have windows, and WinExists can't see them. So basically there is a Big Difference Between a program without a Window, and those that have them.
    1 point
  16. Subz

    What function should I use?

    WinExists = Window Exists ProcessExists = Process Exists If a process doesn't include a window how would you detect?
    1 point
×
×
  • Create New...