Leaderboard
Popular Content
Showing content with the highest reputation on 09/25/2016 in all areas
-
Thanks TheDcoder, you are very kind. I have made a little progress with my problem, but I still willL download and study your UDF. As they are not part of the standard AutoIt libraries, I take it I will need to save them at the end of any script I write If I intend to CALL any of them?1 point
-
I made an UDF called Process UDF, it has useful functions and examples for reading console output .1 point
-
youtuber, Based on your explanation I think this will work... ;#RequireAdmin #include <File.au3> #include <Array.au3> #include <String.au3> Global $aFilters = ['psd','jpg','png','gif','ico','txt','mp3'] Global $aFolder _FileSelectaFolder() Func _FileSelectaFolder() Local $aFolder = FileSelectFolder("Select folder", "", 1) if $aFolder = '' then exit ConsoleWrite('canceled by user' & @CRLF) ; <--- don't want this falling through to the move code $search = FileFindFirstFile($aFolder & "\*.*") If $search = -1 Then MsgBox(0, "Error", "No files") Exit EndIf While 1 $sFile = FileFindNextFile($search) If @error Then ExitLoop $MovieName = $aFilters For $i = 1 To UBound($MovieName) - 1 if stringregexp($sFile,'.*\.(.*)',3)[0] = $MovieName[$i] then FileMove($aFolder & '\' & $sFile, @scriptdir & '\testb\' & $MovieName[$i] & " Archive" & "\" & $sFile, 8) endif Next WEnd FileClose($search) EndFunc ;==>_FileSelectaFolder kylomas note - dest folder name changed for testing...1 point
-
Can't believe you have the know how to do this. If you realy have this knowledge you can also doit with eac3to.exe, so why not using? I am missing the correct params for run, specialy the opt_flag. Without using this flag you never ever got the output from Dir into a variable with the AutoIit StdoutRead() function. Just the same with eac3to.exe . I suggest read helpfile about Run and StdOutRead and test also example. After you have the knowledge to get the output from Dir and also eac3to.exe .1 point
-
You might be able to build something with these two functions... ...returns bytes _WinAPI_GetDriveNumber _WinAPI_GetDiskFreeSpaceEx Success: The array containing the following information: [0] - The total number of available free bytes on a disk. If per-user quotas are being used, this value may be less than the total number of free bytes on a disk. [1] - The total number of available bytes on a disk. If per-user quotas are being used, this value may be less than the total number of bytes on a disk. [2] - The total number of free bytes on a disk.1 point
-
Forum Rules
edenwheeler reacted to Jon for a topic
We want the forum to be a pleasant place for everyone to discuss AutoIt scripting, and we also want to protect the reputation of AutoIt. So we ask you to respect these simple rules while you are here: Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. 2. Do not post material that could be considered pornographic, violent or explicit - or express personal opinions that would not be acceptable in a civilized society. Do not post any copyrighted material unless the copyright is owned by you or by this site. 3. To protect this community, any files posted by you are subject to checks to ensure that they do not contain malware. This includes, but is not limited to, decompilation and reverse engineering. 4. Do not flame or insult other members - and just report the thread to a Moderator (see below) if you are so attacked. 5. Do not PM other users asking for support - that is why the forum exists, so post there instead. 6. Do not create multiple accounts - if you inadvertently created multiple accounts then contact a Moderator to close the unwanted ones. 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. 9. Do not post in a thread while the Moderating team are actively trying to determine whether it is legal. The Moderation team will do their best to act in fair and reasonable manner. Sanctions will only be applied as a last resort and any action taken will be explained in the relevant thread. If moderation action is taken, you will need to acknowledge this through a dialog or you will be unable to post further in the forum. Please note that this dialog is not an agreement that the warning was justified - it is only there so that members are aware that moderation action has been taken and that they may have certain restrictions applied to their account. If you feel that you have been unfairly moderated then contact the Moderator concerned - using a PM or the "Report" button is preferable to opening a new thread (although new members may have to do this). But do be aware that the Moderation team has the final word - the rules are set out by the site owner and you are only welcome here if you respect his wishes. Signatures and Avatars There is no formal policy for the use of signatures but if a moderator thinks it is too big and/or distracting then you may be asked to tone it down. No-one likes wading through signatures that are a page high. Similarly for avatars, expect distracting flashing and animated gifs to be removed. Reporting If you feel a post needs Moderator attention, please use the "Report" button next to the post date at the top. You can then enter details of why you have reported the post - but there is no need to include the content of the post as that is done automatically. The Moderating team will be alerted to the post and will deal with it as soon as they can. If you suspect a EULA violation, do not expect the Moderating team to do all the work - please provide some evidence in the report such as a copy of (or link to) the EULA in question, as well as the section you believe has been violated. Finally, please do not enter into an argument with the original poster - that is why we have Moderators. Spam Please do not react to spam in any way other than reporting it. Multiple reports are combined by the forum software, so there is no need to announce that you have reported the spam - in fact doing so only increases the work for the Moderator who deals with it. Interacting with this website Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login. Automated posting or sending messages on the forum. Automated manipulation of polls, user reputation or other forum features. Automated creation or comments on issue tracker tickets. Automated creation or editing of wiki pages. Other abuses which are either examples of excessive bandwidth usage or automation of the site. Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.1 point -
This is the default behaviour of a treeview, no bug Right click notifications from the treeview must be hit tested for the item under the mouse so the item can be selected. #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $MenuParent, $gui, $contextmenu, $i, $n, $textitem, $Tree, $Child Global $Tree, $tNMHDR, $hWndFrom, $iIDFrom, $iCode, $fOnItem = False Main() While 1 Sleep(100) WEnd Func Main() $gui = GUICreate("Treeview Demo", 300, 500, -1, -1) $Tree = GUICtrlCreateTreeView(-1, -1, 300, 500) For $n = 1 to 9 $Parent = GUICtrlCreateTreeViewItem("Parent " & $n,$Tree) For $i = 1 to 3 $Child = GUICtrlCreateTreeViewItem("Child " & $n & "-" & $i,$Parent) contextMenu($Child) Next Next GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) EndFunc Func contextMenu($MenuParent) $contextmenu = GUICtrlCreateContextMenu($MenuParent) $textitem = GUICtrlCreateMenuItem("Delete", $contextmenu) GUICtrlSetOnEvent ( $textitem, "Delete" ) EndFunc Func Delete() ;If $fOnItem Then ;optionally block menu return from right click over non-item area ;$fOnItem = False _GUICtrlTreeView_Delete($Tree, _GUICtrlTreeView_GetSelection ($Tree)) ;EndIf EndFunc Func Close() Exit EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $Tree Switch $iCode Case $NM_RCLICK Local $tPoint = _WinAPI_GetMousePos(True, $hWndFrom), $tHitTest $tHitTest = _GUICtrlTreeView_HitTestEx($hWndFrom, DllStructGetData($tPoint, 1), DllStructGetData($tPoint, 2)) ;If BitAND(DllStructGetData($tHitTest, "Flags"), $TVHT_ONITEM) Then ;optionally block menu return from right click over non-item area ;$fOnItem = True Local $hItem = DllStructGetData($tHitTest, 'Item') If IsPtr($hItem) Then _GUICtrlTreeView_SelectItem($hWndFrom, $hItem) EndIf ;EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY1 point
-
I got it working. It is working eventhough it does not make any sense. I had used Dim $fbwf = "fbwfmgr.exe" to declare the exe file and it works fine for the enable and disable functions, but the same did not work for the display function. So, I rewrote the steps completely in the Run command without using the declared value and it is working fine. I can't figure that one out. Thanks for all your help. If you don't mind, I definitly need help with the password protection portion from you or any other patient person. I have looked at many of the posts but could not find one that would work for me yet(unless I searched wrong). I will do the ground work first and ask for help later. Thank Mehrdad1 point
-
I can't figure this out. It does not make sense. I have tried many different ways to display the information before reading the string and still will not work. I changed the code to just display the content of the FBWF and I get blank message box after a test message box I inserted after the WEND. I took your first sample code and replaced it in the function and all I get is my test message box and a blank message box, eventhough the example runs fine by itself after. here is the code again with the changes. I appriciate any suggestions. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) Utility() Func Utility() Local $filemenu, $fileitem, $logochange, $exititem, $passwordset, $permission Local $helpmenu, $helpitem, $runmenu, $runitem, $msg, $file Local $WPEnable, $WPDisable, $WPState, $Restart, $Finish, $font, $widthCell Local $runTaskMan, $runCMD, $runUVNC, $STDOUT_CHILD, $STDERR_CHILD Dim $syspath = "c:\windows\system32\" Dim $Utilpath = "c:\program files\DCI Utility\" Dim $fbwf = "fbwfmgr.exe" Dim $fbwfSt = "fbwfmgr.exe /displayconfig" dim $Clogo = "changelogo.bat" GUICreate("DVR Management", 150, 350, -1, -1, 0x16C00000) $filemenu = GUICtrlCreateMenu("&Tools") $passwordset = GUICtrlCreateMenuItem("Set Password", $filemenu) $logochange = GUICtrlCreateMenuItem("Change Logo", $filemenu) $permission = GUICtrlCreateMenuItem("Set Permissions", $filemenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $helpmenu = GUICtrlCreateMenu("Help") $helpitem = GUICtrlCreateMenuItem("How To", $helpmenu) $runmenu = GUICtrlCreateMenu("Run", -1, 1) $runTaskMan = GUICtrlCreateMenuItem("Task Manager", $runmenu) $runCMD = GUICtrlCreateMenuItem("Command Prompt", $runmenu) $runUVNC = GUICtrlCreateMenuItem("Ultr@VNC", $runmenu) $widthCell = 25 Opt("GUICoordMode", 2) $WPEnable = GUICtrlCreateButton("Enable Protection", 1 * $widthcell, 50, 100, 20) $WPDisable = GUICtrlCreateButton("Disable Protection", -1, 30, 100, 20) $WPState = GUICtrlCreateButton("Protection Status", -1, 30, 100, 20) $Restart = GUICtrlCreateButton("REBOOT", -1, 60, 100, 20) $Finish = GUICtrlCreateButton("Close", -1, 30, 100, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $WPEnable RunWait(@ComSpec & " /C " & $syspath & $fbwf & " /enable") ; Will Enable Write Protection MsgBox(4096, "", "Please Click on REBOOT for protection to be Enabled!") Case $msg = $WPDisable RunWait(@ComSpec & " /c " & $syspath & $fbwf & " /disable") ; Will Disable Write Protection MsgBox(4096, "", "Please Click on REBOOT for protection to be Disabled!") Case $msg = $WPState Local $DirCmd = Run(@ComSpec & " /c dir c:\", "C:\", @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD) Local $ResponseText While 1 $ResponseText &= StdoutRead($DirCmd) If @error Then ExitLoop Wend MsgBox (0, "", "test this function") MsgBox(0, "Dir c:\", $ResponseText) ;~ $DirCmd = RunWait(@ComSpec & " /c " & $syspath & $fbwfSt, @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD) ;~ ;~ While 1 ;~ $ResponseText &= StdoutRead($DirCmd) ;~ If @error Then ExitLoop ;~ Wend ;~ ;~ MsgBox(0, "", $ResponseText) ;~ If StringInStr($ResponseText, "filter state: enabled.") Then ;~ MsgBox(0, "Enabled", "Write Protection is ENABLED") ;~ ElseIf StringInStr($ResponseText, "filter state: disabled.") Then ;~ MsgBox(0, "Disabled", "Write Protection is DISABLED") ;~ EndIf Case $msg = $Restart MsgBox(4096, "", "The DVR will Restart now!") Shutdown(2) Case $msg = $Finish MsgBox(4096, "", "Are you sure you want to Exit?") Exit Case $msg = $runTaskMan Run( "taskmgr", $syspath) case $msg = $runCMD RunWait(@ComSpec & " /k", @WindowsDir) Case $msg = $passwordset ; Run( "SetPassword.exe", $Utilpath) MsgBox(4096, "", "This starts the password setup program...") case $msg = $logochange ; RunWait(@ComSpec & " /c" & $Utilpath & $Clogo) MsgBox(4096, "", "This starts the Change Logo program...") case $msg = $permission Run( "Permissions.exe", $Utilpath) MsgBox(4096, "", "This starts the permission setup program...") case $msg = $exititem Exit EndSelect WEnd EndFunc1 point