Leaderboard
Popular Content
Showing content with the highest reputation on 06/27/2017 in all areas
-
Or use an array of functions. Global $aFunc = [Buzz, Noisy, Lazy] For $i = 1 To 10 $aFunc[Random(0, 2, 1)]() Next Func Buzz() Beep(175, 750) EndFunc Func Noisy() Beep() EndFunc Func Lazy() Sleep(1000) EndFunc2 points
-
Edit: A solution was found! Thanks Jos and others who helped me find this: You can have AutoIt run a different "Main" autoit script when you hit F5 instead of the current one, per folder, by doing the following: Run SciTE (might need administrator, depending on how autoit was installed) Options -> global properties (alt o g) Uncomment properties.directory.enable=1 (line 270 in my case) create a file SciTEDirectory.properties in the project's main folder Alternatively, if you don't have admin or don't want to edit the global.properties for whatever reason, you can just skip step 1,2,3 and name it SciTE.properties Put in the file you created command.go.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "NAME OF SCRIPT HERE.au3" /UserParams $(1) $(2) $(3) $(4) Save the file. Now anything you run in that folder or subfolder will run the main script when you hit F5 Using SciTEDirectory.properties effects that folder and subfolders, where as SciTE.properties only effects that folder. Apart from that they work the same Original question: I have a main script, and a bunch of includes / udf's. Almost every single time I edit my includes I hit F5 to run the script, but it runs the include instead. I'm tired of switching back to the main script's tab in SciTE to run it, just to switch back to the include. Is there some kind of #flag or option to set a "main au3 file" so when I hit F5, it will see that and run the main file instead?1 point
-
The question has been answered so it doesn't remain. You cannot step through AutoIt code ala VBE, you have to insert the debugging break points yourself.1 point
-
That shouldn't be too hard to come up with yourself when using Random() and Call() functions. Jos1 point
-
[Solved] How can I detect manual execution of a script?
Soulstriker reacted to Jos for a topic
Forgot to include the fact that @AutoItPID contains the PID of the current script and could/should be used as the first level pid. Jos1 point -
Continue to write _FileWriteLog after system restart
SkysLastChance reacted to Subz for a topic
I you use FileOpen with mode = 1 then it will always append to end of your file something like: #include <File.au3> OnAutoItExitRegister("_LogClose") Global $hLogFile, $sLogFile, $bLog = False LogFilePath() Func LogFilePath() If $bLog = False Then $sLogFile = EnvGet("SystemDrive") & "\Temp\Test\Test.log" $hLogFile = FileOpen($sLogFile, 9) ;~ Create Folder/File and append to end of file if it already exists If $hLogFile > -1 Then _FileWriteLog($sLogFile, "Line 1") _FileWriteLog($sLogFile, "Line 2") _FileWriteLog($sLogFile, "Line 3") _FileWriteLog($sLogFile, "Line 4") $bLog = True EndIf EndIf EndFunc ; Step 1 Function ;~ Check if Step 1 has been completed If FileExists(@ProgramFilesDir & "\Filepath1\Filename1.exe") = 0 Then ;~ Run Step 1 Installer here RunWait('MsiExec.exe /i "' & @ScriptDir & '\FileName1.msi" /qb /norestart') If $bLog = True Then _FileWriteLog($sLogFile, "Step 1 Completed") EndIf ; Step 2 Function If RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{Guid}", "DisplayName") = "" Then ;~ Run Step 2 Installer here RunWait('MsiExec.exe /i "' & @ScriptDir & '\FileName2.msi" /qb /norestart') If $bLog = True Then _FileWriteLog($sLogFile, "Step 2 Completed") EndIf ; Reboot ; Step 3 Function ; Want to continue the log lines after line 6. Func _LogClose() FileClose($hLogFile) Exit EndFunc1 point -
Better way to edit text config file?
mithandir1 reacted to Subz for a topic
Melba beat me to it but I'll post my example as well #include <Array.au3> #include <File.au3> Global $aConfig, $sConfig = @ScriptDir & "\Config.cfg" _FileReadToArray($sConfig, $aConfig) For $i = 1 To $aConfig[0] If StringInStr($aConfig[$i], "a4.station.name=") Then $aConfig[$i] = "a4.station.name=SomethingNew" Next _FileWriteFromArray($sConfig, $aConfig, 1) _ArrayDisplay($aConfig)1 point -
Better way to edit text config file?
mithandir1 reacted to Melba23 for a topic
mithandir1, Read the file into an array, search for the correct line and amend it, rewrite the file: #include <Array.au3> $sInsert = "Fred is a happy boy" ; Read in whole file into an array (simulated here) Global $aLines[] = ["#", _ "# 6/26/2017 3:32:09 PM", _ "a4.max.logins.timeout=20", _ "a4.turn.port=67000", _ "a4.pfx.password=something", _ "a4.organization.name=Contoso Ltd", _ "a4.http.port=80", _ "a4.https.port=120", _ "a4.station.name=Something I don't know", _ "a4.video.minport=1234", _ "a4.turn.maxport=1240", _ "a4.audio.gain=20", _ "a4.ice.type=local-turn", _ "a4.turn.minport=53102", _ "a4.tab.window.left=52131", _ "a4.tab.window.right=78942", _ "a4.max.logins=2"] For $i = 0 To UBound($aLines) - 1 If StringInStr($aLines[$i], "a4.station.name") Then $aLines[$i] = "a4.station.name=" & $sInsert ExitLoop EndIf Next _ArrayDisplay($aLines, "", Default, 8) ; Now rewrite file from the array M231 point -
You need to save the status of your script in a location that survives the reboot (Ini-file, registry ...). First step in your script is then to check and reset this state. You then call your functions depending on the state.1 point
-
I would not recomment to modify SciTEGlobal.properties since this file will be overridden with the next installer. Either go the SciTE.properties route or modify that setting in your SciTEUser.properties. Jos1 point
-
@Skysnake I must admit, when I did this I was a complete nab. Okay, I still am. I played with trancexx's Resource Viewer and Compiler but I don't understand all of the code so my attempt to automate the compiling of 300+ icons was still not optimal. It's fast for the first 50 icons, then slows to a crawl. IIRC it was a recursive function that defeated me. Give this a go, it also has the added bonus of not rejecting .ico's with layers 256 x 256 or larger. ResourcesViewerAndCompilerModified.au3 Action -> Initialise compiler Action -> Generate inital dll Drag-and-drop icons in (only one drag-and-drop operation as its late and remember- im a nab) File -> Save as...1 point
-
Thanks Jos, I think I found it. For anyone looking to set a custom command, here are the steps: Run SciTE (might need administrator, depending on how autoit was installed) Options -> global properties (alt o g) Uncomment properties.directory.enable=1 (line 270 in my case) create a file SciTEDirectory.properties in the project's main folder Alternatively, if you don't have admin or don't want to edit the global.properties for whatever reason, you can just skip step 1,2,3 and name it SciTE.properties Put in the file you created command.go.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "NAME OF SCRIPT HERE.au3" /UserParams $(1) $(2) $(3) $(4) Save the file. Now anything you run in that folder or subfolder will run the main script when you hit F5 I love this solution, it is a lot better than modding UDFs and works almost out-of-the-box. Thanks for pointing me in the right direction1 point
-
AUTOIT WITH PYHTON
Xandy reacted to JLogan3o13 for a topic
If you google python windows error 193 you'll see a number of threads on the topic.1 point -
I changed some functions and wrote some new, now its possible, what you want to do Changed: __ListViewEditInput_InitializeKeys: Its now possile to add an Array with Accelerators when initializing __ListViewEditInput_WM_NOTIFY: outsourced Quellcode to another Function (__ListViewEditInput__EditItem) Added: __ListViewEditInput_GetEditedCell: Returns the Ctrl,index and subindex of last edited/actual editing cell __ListViewEditInput__EditItem: Set Cell to edit, needs listviewcontrol, itemindex and subitemindex For testing I wrote an Example. Interesting for you is Line 14-16 and 45-52 MfG Kanashius Example_wingnut.au3 ListViewEditInput.au31 point
-
Use SQLite when you have many rows. Then you will see the power of it. Also use transactions for speed optimize. If you explicitly don't call BEGIN/COMMIT then SQLite internally call COMMIT after each command which slows down whole process. _SQLite_Startup() _SQLite_Open("C:\Mark\Programs\Database\test.db") _SQLite_Exec (-1, "BEGIN;") _SQLite_Exec(-1,"Insert into tblTest8 values ('1',2,3);" & _ "Insert into tblTest8 values (Null,50,6);") ; ... many other insert/update/delete commands here ... _SQLite_Exec (-1, "COMMIT;") _SQLite_Close() _SQLite_Shutdown() EDIT: Also as opposite to plain TXT you can quickly pick up set of desired rows from large amount of records by SELECT ... FROM ... WHERE ...1 point