-
Posts
248 -
Joined
-
Last visited
Community Answers
-
Geir1983's post in [Question] Trigger IF function every x amount of times in a do.. until.. loop was marked as the answer
Do something like this?
Edit: didnt read the part about the % of your loop.
b= IniReadSection ($Config, "Records") $Range= $b[0][0] _ConsoleWrite ("Debug: Number of Records Found" & $Range, 3) $j= 0 $Loopcounter = 0 $DoEvery = Int($Range / 4) ;amount of loops before doing action at every 25% Do $Loopcounter += 1 $a = IniRead($Config, "Records", "Record" & $j, "0|0") $aArray = StringSplit($a, "|") MouseMove($aArray[1],$aArray[2],1) _ConsoleWrite ("Debug: Location X: " & $aArray[1] &"| Y: "& $aArray[2], 4) If Mod($Loopcounter, $DoEvery) = 0 Then $StopLoop = _CheckNotification() If $StopLoop = 1 Then $ErrorOnWalkThrough = 1 _ConsoleWrite("Error detected", 1) ExitLoop EndIf $j = $j + 1 Until $j= $Range -
Geir1983's post in FileCreateShortcut works but not working right,, was marked as the answer
I think you need to look at the order of your operations.. everything is done line by line. your $cmd for instance is always empty because you copy $ifullpath to it when $ifullpath is still not read from your ini file.
Edit: Also you have decleared $ifullpath both as a local and as a global variable, this can cause you some headace.
-
Geir1983's post in Issue trying to get data from an array was marked as the answer
Try to check the return from StringRegExp for error before you continue
#include <File.au3> #include <Array.au3> ; Just for display <<<<<<<<<<<<<<<<<<<<< #include <Excel.au3> #include <MsgBoxConstants.au3> HotKeySet("{ESC}", "Terminate") Func Terminate() Exit EndFunc ;==>Terminate $path = InputBox("Input Path", "Enter Path to Files:" & @CRLF & "Press ESC at any time to cancel the script.") $pathexists = FileExists($path) If $pathexists = 0 Then MsgBox($MB_SYSTEMMODAL, "Path Error", "File Path Does Not Exist.") Exit EndIf Global $xmlfiles = _FileListToArray($path, "*.xml", 1) Global $aArray[0] Global $aInTC[0] Global $aInHr Global $aInMin Global $aInSec Global $aInFr For $b = 1 To UBound($xmlfiles) - 1 switch $xmlfiles[$b] case StringInStr($xmlfiles[$b], ".xml") = 0 MsgBox($MB_SYSTEMMODAL, "Error", "No .xml files found in:" & @CRLF & $path) Exit Case Else _TimecodeAdd() EndSwitch Next Func _TimecodeAdd() _FileReadToArray($path & "\" & $xmlfiles[$b], $aArray) _ArrayDisplay($aArray,"") For $z = 1 To $aArray[0] - 1 $aInTC = StringRegExp($aArray[$z], 'InTC="([0-9]{2}):([0-9]{2}):([0-9]{2}):([0-9]{2})"',3) IF @error Then ContinueLoop _ArrayDisplay($aInTC, "") ;<--This displays the proper array of digits so long as nothing tries to call a cell after this ReDim $aInTC[4] ;<-- Causes "ReDim Used without variable error" MsgBox($MB_SYSTEMMODAL, "Does It Work?", $aInTC[0]) ;<--Causes Subscript error ConsoleWrite($ainTC[0] & ":" & $ainTC[1] & ":" & $ainTC[2] & ":" & $ainTC[3]) ;<--Causes Subscript error Next EndFunc -
Geir1983's post in Question: Perfectly mapping mouse button to keyboard key was marked as the answer
Try it like this, i think you keep calling the same function over and over when space is beeing pressed.
#include <Misc.au3> HotKeySet("{SPACE}", "MouseLeft") While 1 Sleep(1000) WEnd Func MouseLeft() HotKeySet("{SPACE}", "_IgnoreSpace") MouseDown("Primary") Do Sleep(10) Until Not _IsPressed('20') MouseUp("Primary") HotKeySet("{SPACE}", "MouseLeft") EndFunc Func _IgnoreSpace() Sleep(10) EndFunc -
Geir1983's post in String, interger and binary stuff question was marked as the answer
you need to specify the length to read, default is a dword (4 bytes).
$MemRead = _MemoryRead("0x" & "0095CD48", $Process, "char[80]") -
Geir1983's post in help my logic plz xD was marked as the answer
Does your function _A close the file after using it?
If you use FileOpen, you have to close it also.
If you only use FileWriteLine you dont need to close it.
-
Geir1983's post in Help on my first script ever was marked as the answer
$Repeat = 10 For $idx=1 to $Repeat MouseClick("left", 1840, 139, 2, 500) Sleep(200) Send("^x") Sleep(200) Send("{DEL}") Sleep(100) MouseClick("left", 600, 840, 2, 500) Sleep(300) Send("^v") Sleep(300) Send("{ENTER}") Next -
Geir1983's post in find oldest file(s) in directory was marked as the answer
Another example
#include <File.au3> #include <array.au3> Local $sSearchPath = "c:\test\" Local $aFileList = _FileListToArray($sSearchPath, "*.*") Local $aExtendedFileList[$aFileList[0]+1][2] for $i=1 to $aFilelist[0] $aExtendedFileList[$i][0] = $aFileList[$i] $aExtendedFileList[$i][1] = FileGetTime($sSearchPath & $aFileList[$i] , $FT_MODIFIED, 1) next _ArraySort($aExtendedFileList, 0,0,0, 1) _ArrayDisplay($aExtendedFileList, "$aFileList") -
Geir1983's post in Wait few Sec, then continue was marked as the answer
Just change the timderdiff value. And add a sleep in there to conserve your cpu load.
Local $timer = TimerInit() While TimerDiff($timer)<15000 Sleep(10) $text=ControlGetText("[CLASS:tooltips_class32]","","") $strtxt = StringMid($text, 1, 1) If $strtxt = "C" Then ExitLoop WEnd -
Geir1983's post in Login And Password Before Showing GUI was marked as the answer
Quick and dirty:
#include <GUIConstantsEx.au3> #include <GuiSlider.au3> $GUI = GUICreate("Login", 210, 80, -1, -1, 0x16C80000, 0x00000181) $USERNAME = GUICtrlCreateInput("Type here username", 5, 5, 200, 20, 0x01) $PASSWORD = GUICtrlCreateInput("Password", 5, 30, 200, 20, 0x21) $LOGIN = GUICtrlCreateButton("Login", 50, 55, 100, 20) GUISetState(@SW_SHOW, $GUI) Local $LoggedIn While Not $LoggedIn $MSG = GUIGetMsg() If $MSG = $LOGIN Then If GUICtrlRead($USERNAME) == "1" And GUICtrlRead($PASSWORD) == "1" Then $LoggedIn = TRUE GUIDelete($GUI) ;Assuming 2nd GUI goes here some how Else MsgBox(0, "Login", "Incorrect username or password.") EndIf ElseIf $MSG = -3 Then Exit EndIf Sleep(20) WEnd Global $hGui, $iSlider, $iLabel, $nMsg Global $iOld = 0, $iCur = 0 $hGui = GUICreate("Slider test", 500, 500, -1, -1) $iSlider = GUICtrlCreateSlider(50, 30, 180, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS)) GUICtrlSetLimit(-1, 4000, 1000) $iLabel = GUICtrlCreateInput(GUICtrlRead($iOld), 40, 80, 100, 20) $Button = GUICtrlCreateButton("Button", 150, 80, 100, 20) GUISetState(@SW_SHOW, $hGui) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $iSlider Case $Button $ShowMessag = MsgBox(0, "Title", GUICtrlRead($iLabel)) Case Else $iCur = GUICtrlRead($iSlider) If $iOld <> $iCur Then $iOld = $iCur GUICtrlSetData($iLabel, "" & $iOld) EndIf EndSwitch WEnd -
Geir1983's post in Problems working out how to embed a DLL inside a compiled script was marked as the answer
Just test like you do at the very beginning of the script, if the file is already installed do nothing. If the dll is not installed then use fileinstall to place it in your prefered location. Next time you start your executable script it will find the dll file and no further action (fileinstall() )necessary.
-
Geir1983's post in What did i do wrong ? was marked as the answer
Yeah, Palestinian is correct, you need to use GuiCtrlRead to get the value from $Input1
-
Geir1983's post in Array compare was marked as the answer
I think the PID will change for every time you start a process, how can you store a bunch of PID and know what it is?
ProcessList will return in element 0 the number of results so you should start your loop with i=1
-
Geir1983's post in GUICtrlSetImage without stretch? was marked as the answer
Thanks, the Default was what I needed
Func _ChangePic($ElementId, $Picture) ; Initialize GDI+ library _GDIPlus_Startup() ; Get bitmap $hBitmap = _GDIPlus_BitmapCreateFromFile($Picture) ; Get size $iX = _GDIPlus_ImageGetWidth($hBitmap) $iY = _GDIPlus_ImageGetHeight($hBitmap) ; Clean up resources _GDIPlus_BitmapDispose($hBitmap) ; Shut down GDI+ library _GDIPlus_Shutdown() GUICtrlSetPos ($ElementId, Default , Default , $iX , $iY ) GUICtrlSetImage($ElementId, $Picture) Return EndFunc