Leaderboard
Popular Content
Showing content with the highest reputation on 06/21/2017 in all areas
-
folder wildcard method?
beato reacted to JLogan3o13 for a topic
In your case, you'll want to do something like this once you have the array (pseudo) #include <File.au3> Local $aTemp Local $aFiles = _FileListToArray(@UserProfileDir & "\AppData\Roaming", "*", $FLTA_FOLDERS, True) For $a = 1 To $aFiles[0] $aTemp = StringSplit($aFiles[$a], "\") DirCopy($aFiles[a], <path to server> & $aTemp[$aTemp[0]]) Next Please ask if you have any questions.1 point -
AutoIt does not support safearray. You can do something like this: #include "SafeArray.au3" Global Const $sTag_IDispatch = _ "GetTypeInfoCount hresult(dword*);" & _ ; Retrieves the number of type information interfaces that an object provides (either 0 or 1). "GetTypeInfo hresult(dword;dword;ptr*);" & _ ; Gets the type information for an object. "GetIDsOfNames hresult(ptr;ptr;dword;dword;ptr);" & _ ; Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used on subsequent calls to Invoke. "Invoke hresult(dword;ptr;dword;word;ptr;ptr;ptr;ptr);" ; Provides access to properties and methods exposed by an object. Global Const $sIID_IVirtualBox = "{0169423F-46B4-CDE9-91AF-1E9D5B6CD945}" ;Dummy v-table Global Const $sTagIVirtualBox = $sTag_IDispatch & "Dummy1 hresult();Dummy2 hresult();Dummy3 hresult();Dummy4 hresult();Dummy5 hresult();Dummy6 hresult();Dummy7 hresult();Dummy8 hresult();" & _ "Dummy9 hresult(); Dummy10 hresult();Machines hresult(ptr*)" _Example() Func _Example() Local $oVirtualBox = ObjCreate("VirtualBox.VirtualBox") If Not IsObj($oVirtualBox) Then Return 0 Local $oIVirtualBox = ObjCreateInterface($oVirtualBox, $sIID_IVirtualBox, $sTagIVirtualBox) Local $pMachines = 0 $oIVirtualBox.Machines($pMachines) Local $iDim = SafeArrayGetDim($pMachines) Local $iUBound=0 SafeArrayGetUBound($pMachines, 1, $iUBound) Local $tTypeArray = DllStructCreate($tagSAFEARRAY, $pMachines) Local $iPtrSize = (DllStructGetData($tTypeArray, "cbElements")) Local $paMachineArrayData = 0 Local $tMachine = 0 Local $poMachine = 0 Local $oMachine = Null SafeArrayAccessData($pMachines, $paMachineArrayData) For $i = 0 To $iUBound $tMachine = DllStructCreate("ptr", $paMachineArrayData + ($i * $iPtrSize)) $poMachine = DllStructGetData($tMachine, 1) $oMachine = ObjCreateInterface($poMachine, "", Default, False) ConsoleWrite("Machine[" & $i & "].Name : " & $oMachine.Name & @CRLF) $poMachine = 0 $tMachine = 0 $oMachine = Null Next SafeArrayUnaccessData($pMachines) EndFunc It needs SafeArray.au3 Saludos1 point
-
That's Ok, thanks for the info, I'll have a search. It is easier to read all the sheet in one go into an array then use the array from there on, so that's how I'll work it.1 point
-
Well, after the initial loading, when I selected 1001 from the list and pressed Get Info button, I got an error from the excel udf. As I understand it, the basic operation is to read the information from the sheet, load the Staff# into the listbox, when the Staff# is selected, pressing Get Info should get the related info, Name. Dept, Joining and Id and input them into the inputs. Is this correct? The other labels that are created but not visible because the GUI is to small, they are the text of the excel columns, like Id etc?.1 point
-
Can I use Send {ASC} with hotkeys?
Xandy reacted to JLogan3o13 for a topic
@leuce I believe you are hitting an issue with Send trying to operate before your hotkeys have finished fully. This works just fine for me; you'll have to find the sweet spot: HotKeySet("^-", "Test") while 1 sleep(100) WEnd Func Test() Sleep(500) Send("{ASC 0150}") EndFunc1 point -
I agree. I would expect the button to show the "Value Does Not Exist" message on the attempts due to unchecked errors from the _Excel_RangeFind and\or _ArrayExtract functions. @Rimoun Try Danp2's suggestion and comment out the line below just as a test. If the button works multiple times then that's the issue and it needs to be moved somewhere else _Excel_Close($oExcel, Default, True)1 point
-
@benners Very true. However, I believe the crux of the issue is that he's closing Excel and then attempting to perform additional actions in Excel.1 point
-
I think it's just that the code needs tidying and reorganizing. There are a few improvements that could be made.1 point
-
Do you have an excel sheet to try this with?, make sure there is no personal\private info inside. Some suggestions about the code. Don't declare Globals in functions, or locals in loops. A lot of the variable have already been declared and you are declaring the again with the same values.1 point
-
How about this? Local $bBreak = False While 1 ; this is the part i wanted to stop but not closing the GUI Send("0") For $i = 0 To ($readInput / 100) Sleep(100) If GUIGetMsg() = $StopScript Then GUICtrlSetData($switch, 'Off') GUICtrlSetBkColor($switch, 0xff0000) $bBreak = True EndIf If $bBreak = True Then ExitLoop Next If $bBreak = True Then ExitLoop WEnd ; end of the while loop for the sendkey1 point
-
@steveeye Just to point you in the right direction: https://www.sitepoint.com/12-amazing-jquery-tables/1 point
-
Convert a string into 2D Array
FrancescoDiMuro reacted to JLogan3o13 for a topic
Just out of curiosity, why not move the logic up a level and use _ArrayAdd, like so: ;instead of For $oElement In $oQuery $sStringToArray &= $oElement.SomeData1 & _ $oElement.SomeData2 & _ $oElement.SomeDataN Next ... StringSplit... etc... ;Define your array ahead of time, then populate it through your For Loop For $oElement In $oQuery _ArrayAdd($myArray, $oElement.SomeData1 & "|" & $oElement.SomeData2 & "|" & $oElement.SomeDataN Next1 point -
This is a UDF I created for myself, to handle file locking on an SQLite database that was being shared on a network. Since I did not want to run a process on the server to handle the file locking, I needed a way to avoid write conflicts from the clients themselves. ********** Thanks to an ISP problem, the ZIP download is not available. The most recent code will be maintained here. ********** Updated to work with 64-bit Win7 Minor performance enhancement as proposed by orbs (see >post #15) If you want to see it in action, before implementing it in your own production scripts, I have written up a little demo here: Make sure to set $logpath and $logfile to a proper location on your PC or network. Run the demo as many times as you like on a single machine to simulate multiple machines, or run on several machines. You will be able to see when each session gets its "lock" on the log file. You can also look at the log file itself to see what sessions/machines got access. NOTE: Because of the way Windows handles multitasking, you will probably see groupings of the same session getting its lock several times before the next one. This is because Windows does not do a very good job of sharing the processor between applications, so one session may make several iterations before Windows pulls processor time away for the next session. You will see a better distribution if you actually use multiple machines rather than simulated machines. For those who are wanting them, here are the "help" files that were included in the original ZIP file. Nothing spectacular. They are just a cut back demo designed to look like what would be in the help file if this were included.1 point