Jump to content

Search the Community

Showing results for tags 'func'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

  • 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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 15 results

  1. Hi guys, I see many script for delete files older then x in this forum, i found this and i think is very useful: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 _FilesOlder(@ScriptDir, "*.*", 7, 1) ; Look for wildcards in the Help file. ; _FilesOlder("DIRECTORY", "FILTER [Default *.*]", "NUMBER OF DAYS [Default 0]", "RECURSIVE SEARCH [Default 1 - Yes]") Func _FilesOlder($sFilePath, $sFilter = "*.*", $iDate = 0, $iRecursive = 1) Local $aFilter, $sCommand = "del /q @path", $sDate = "", $sRecursive = "" $sFilePath = StringRegExpReplace($sFilePath, "[/]+z", "") & "" If $iDate > 0 Then $sDate = "/d -" & $iDate EndIf If $iRecursive Then $sRecursive = "/S" EndIf $aFilter = StringSplit($sFilter, ';') For $A = 1 To $aFilter[0] RunWait(@ComSpec & ' /c ' & 'forfiles /P ' & $sFilePath & ' ' & $sRecursive & ' /M ' & $aFilter[$A] & ' ' & $sDate & ' /C ' & ' "cmd /c ' & $sCommand & '"', $sFilePath, @SW_HIDE) Next EndFunc ;==>_FilesOlder But for me not work, don't delete any files. What is the problem? Thanks
  2. Hi, I wrote the below code to learn user defined functions.. jam is the function which calculates summation and division of two numbers $a, $b.. I expect the $sum and $div receives the results $r and $s respectively from the function... but the msbox in the main program doesn't display results properly, while the one inside func shows it correclty. how do I pull the values in $r and $s to $sum and $div respectively.. thanks for all the help on this forum global $a,$b,$sum,$div $a=1 $b=2 jam($a,$b,$sum,$div) msgbox(0,"results",$sum&" , "&$div) func jam($p,$q,$r,$s ) $r=$p+$q $s = $p/$q msgbox(0,"results",$r&" , "&$s) EndFunc
  3. Hi I am trying to check a number of applications are up to date and install the update if required. This will run as a shutdown script, pushed out through Group Policy. I am querying various registry keys to determine if The software is actually installed The software is at the correct version Once the need for update is determined then it calls another function to run the update. If the software is up to date or not installed, it moves down to the next software section which changes the registry key variables and calls the registry query function again I have managed to get the function for (un)installs to work but I am having trouble with the registry query function #NoTrayIcon #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> ; Here we go! ;########################################################################################################## ;Declare variables Global $RegKey86, $RegKey64, $RegValueName, $RegValueData, $CheckVersion86, $CheckVersion64 ; 7Zip ;########################################################################################################## _7Zip_Function() Func _7Zip_Function() ; Registry location and values that are checked for current software version ; Ensure the x64 key is preceeded with 'HKLM64' $RegKey86="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" $RegKey64="HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" $RegValueName="DisplayVersion" $RegValueData="16.04" ; Excecution ; --------------------------------------------------------------------------------------------------------- If _CheckSW() = 1 Then _UninstallOldVer() _InstallSW() EndIf EndFunc ;==>_7Zip_Function ; Functions ;########################################################################################################## Func _CheckSW() $CheckVersion86=RegRead ($RegKey86, $RegValueName) $CheckVersion64=RegRead ($RegKey64, $RegValueName) If $CheckVersion86=$RegValueData Or $CheckVersion64=$RegValueData Then Return 0 ElseIf $CheckVersion86="" And $CheckVersion64="" Then Return 0 Else Return 1 EndIf EndFunc ;==>CheckSW
  4. Hi guys, Could someone please tell me what I'm doing wrong with this code? I'm trying to take user input and then run a function with the same name, but it's not calling the function. So in the below after pressing Shift+F8 I would enter the text (without quotes) "testFunc". As you can see I've also tried this with IF statements, I'm new to using Switch/Case. HotKeySet("+{F8}", RunManually) Func RunManually() ;Use a case statement with 1 hot key and an InputBox to manually run functions $funcName = InputBox("Which Func to Run?", "Enter the name of the function to run") MsgBox(0, "Entered value", $funcName) ;If $funcName = testFunc Then testFunc() ;If $funcName = test2Func Then test2Func() Switch $funcName Case testFunc MsgBox(0, "Calling", "Calling Function") testFunc() MsgBox(0, "Called", "Function call finished") Case test2Func MsgBox(0, "Calling", "Calling Function") test2Func() MsgBox(0, "Called", "Function call finished") EndSwitch EndFunc While 1 ;testFunc() Sleep(1000) WEnd Func testFunc() MsgBox(0, "func running", "Seems to work!") EndFunc Func test2Func() MsgBox(0, "func 2 running", "2 Seems to work!") EndFunc Thanks!
  5. So currently I have some code waiting for a status to change(there is different indicators to check if this status has changed) Func oneRow($count) $globaltimer = _Timer_SetTimer($gui, 60000*10, "reset") $errTimer = TimerInit() While (1)         If PixelGetColor(1117, 326) = 0xC6C6C6 Then ExitLoop (1)         Sleep(500)         MouseClick("right")         Sleep(600)         If PixelGetColor(1117, 326) = 0xC6C6C6 Then ExitLoop (1)         If TimerDiff($errTimer) > 5000 Then             If PixelGetColor(1100, 310) = 0x707070 Or PixelGetColor(901, 305) = 0xE0E0E0 Or PixelGetColor(1043, 383) = 0xC6C6C6 Then                 Sleep(100)                 Send("{esc}")                 Sleep(1000)             EndIf         EndIf     WEnd .... EndFunc   ;==>oneRow The two timers is for error checking. This works just fine the problem comes when I go into the while 1 loop, my hotkeys at the top of the program seems to stop working, for an example HotKeySet("{f1}", "stop") Func stop() Exit EndFunc ;==>stop Does not work at all after the while loop. The globaltimer is never called even though i tried setting the delay all the way down to 3 seconds. So I thought that maybe one of the function I use is blocking so the timer would never be called/the hotkey wouldn't work? if i make an delay just before the while loop the hotkey works just fine. Oh and the errTimer is supossed to not reset after 5 seconds but should keep making the check it does if five seconds have passed
  6. The best example is MouseClick, where you have MouseClick($Button, [$x, $y, [..........]]) Where if X is set, Y must be set too. I do know how to make it so that X and Y are optional, but I am not sure how to get Y mandatory if X is set. I did check the help, but didn't see anything there. Thanks in advance
  7. <snip> Hello , This time my script is throwing an error which does not make sense... How can I fix this? Code Snippet from the screenshot: P.S You saw it right, I am making a small handy tool for AutoIt Coders, TD
  8. Ther is no something like $pos++, and that would be easy like $array[$pos++] I cant find out what is the solution for this problem, maybe someone can help me Thank you! #include <array.au3> Local $array[1024] Local $pos = -1 $array[PosIncrease()] &= "start" For $i = 1 To 10 $array[PosIncrease()] &= "new value" ConsoleWrite($pos & @CR) Next $array[PosIncrease()] &= "end" _ArrayDisplay($array) Func PosIncrease() $pos += 1 ConsoleWrite(" ++ "& $pos & @CR) Return $pos EndFunc
  9. Goodmorning people, I've been busy with a usefull script for work but one part is not working as I thought it would. I took the known _IsEnabled function, change 3 words to have it check an disabled checkbox status The code below is not the actual script but it demonstrates the error. If you select "Check all but disabled" it will select all 3 checkboxes which is not my intention, ehh help? #include <MsgBoxConstants.au3> #include <GuiConstants.au3> #include <GuiConstantsEx.au3> Local $box[03] GuiCreate("Test", 300, 300, -1, -1) $box[00] = GUICtrlCreateCheckbox("Unchecked", 20, 40, 240, 20) $box[01] = GUICtrlCreateCheckbox("Disabled", 20, 60, 240, 20) $box[02] = GUICtrlCreateCheckbox("Checked", 20, 80, 240, 20) GUICtrlSetState($box[00], $GUI_UNCHECKED) GUICtrlSetState($box[01], $GUI_DISABLE) GUICtrlSetState($box[02], $GUI_CHECKED) $Button_Ok = GUICtrlCreateButton("Check all but Disabled", 20 , 110, 180, 45) $Button_KO = GUICtrlCreateButton("UnCheck all", 20 , 155, 180, 45) GuiSetState() Func _IsDisable($control) Return BitAND(GUICtrlRead($control), $GUI_DISABLE) = $GUI_DISABLE EndFunc While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_Ok For $i = 0 to 2 If _IsDisable($box[$i]) Then GUICtrlSetState($box[$i], $GUI_UNCHECKED) Else GUICtrlSetState($box[$i], $GUI_CHECKED) EndIf Next Case $msg = $Button_KO For $i = 0 to 2 GUICtrlSetState($box[$i], $GUI_UNCHECKED) Next EndSelect WEnd
  10. Hey folks, I just explored the new helpfile and found a new Keyword (dunno if its that new, but i never saw it before) called Volatile. It was made especally for CallBack and Com event functions, so I wanted to try that out. the advantage of this Keyword is, that you can run the Dll while you can do other things in autoit (AutoIt wont freeze/pause anymore while the dllcall is executed!) I made up a little example i want to share with you, the c source is compiled in MinGW, you need at least AutoIt 3.3.10.2. Hope you like it, would be interested in some comments Greetz, Spider testLibCallback.zip
  11. Hello I am trying to figure out why I am getting the error: Array variable has incorrect number of subscripts or subscript dimension range is incorrect And how to fix it. Here is my code: Func mysql($branch) ; , $element) ; establish an array with too many elements Local $output[80] ; establish a counter starting at zero $count = 0 ; put query together $sql = _MySQLConnect("DHCP","1234","test","192.168.26.18") $var = _Query($sql,"SELECT * FROM Leases WHERE Branch='" & $branch & "'") With $var ;loop through the query result While NOT .EOF ;put data into array $output[$count]=.Fields("IP").value ; This is where the error is. ;increment the counter $count += 1 ; end of the loop wend ; resize the array to the number of elements ReDim $output[$count] EndWith ; return the proper sized array return $output EndFunc Thanks Grimm
  12. hello, now i have a script and need it to stop it's function when "F3" is pressed. but i don't know what's wrong check that: HotKeySet("{F2}", "MSG") HotKeySet("{F3}", "xt") Func MSG() $chk = 1 while 1 MsgBox(0, "TEST", "1") MsgBox(0, "TEST", "2") MsgBox(0, "TEST", "3") MsgBox(0, "TEST", "4") MsgBox(0, "TEST", "5") $chk = 0 wend EndFunc ;==>MSG Func xt() $chk = 0 EndFunc ;==>xt While 1 Sleep(200) WEnd EDIT: I want it stop wherever which msgbox running whether msg1 or msg2 etc..
  13. hi agian , i need to make True progressbar.. you'll say "True?? How?" xD i'll tell you. in this script: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Crypt.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 385, 125, -1, -1) $Progress1 = GUICtrlCreateProgress(32, 32, 294, 17) $Label1 = GUICtrlCreateLabel("0", 336, 33, 10, 17) $Button1 = GUICtrlCreateButton("Button1", 160, 80, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $source = @ScriptDir & "dd.exe" $save = @ScriptDir &"dd" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Crypt_EncryptFile($source, $save, "123", $CALG_AES_256) EndSwitch WEnd Suppose the file size is "5 MB" so it will take time to encrypt it i need to make the progressbar loading with encrypting and finish with it too, not like this prog' for $i = to 100 sleep(10) guictrlsetdata($progress, $i) this progress above is not true.. i think now my problem explained all helps appreciated.. thanks.
  14. Below is my script. Can you please tell me why I keep getting exit code 0, and the script stops? I'm expecting it to just idle in the background and await my hotkey pressing. Global $Paused HotKeySet("F7", "Cycle2") HotKeySet("F8", "Cycle1") HotKeySet("F9", "Cycle3") Func Cycle3() $Paused = NOT $Paused MouseClick("left", 920, 755, 1, 25) ;taskbar MouseClick("left", 776, 598, 1, 25) ;region MouseClick("left", 575, 565, 1, 25) ;pgdown MouseClickDrag("left", 325, 310, 500, 575, 25) Exit 0 EndFunc Func Cycle2() $Paused = NOT $Paused MouseClick("left", 920, 755, 1, 25) ;taskbar MouseClick("left", 776, 598, 1, 25) ;region MouseClick("left", 575, 565, 1, 25) ;pgdown MouseClick("left", 575, 310, 2, 25) ;up MouseClickDrag("left", 325, 310, 500, 575, 25) Global $Paused EndFunc Func Cycle1() $Paused = NOT $Paused MouseClick("left", 920, 755, 1, 25) ;taskbar MouseClick("left", 776, 598, 1, 25) ;region MouseClickDrag("left", 325, 310, 500, 575, 25) Local $i = 0 Do Sleep(2000) ;2-second sleep Cycle2() $i = $i + 1 Until $i = 7 Global $Paused EndFunc
  15. Hi, at this path "@programfilesdir\AutoIt3\SciTE\api" there's file "au3.user.calltips.api" this file add funcs to autoit okay, now i added my func. but i want make it's color blue like other funcs. how should i do this thanks.
×
×
  • Create New...