mrmacadamia
Active Members-
Posts
108 -
Joined
-
Last visited
mrmacadamia's Achievements
Adventurer (3/7)
0
Reputation
-
Using list to replace a value in multiple files
mrmacadamia replied to mrmacadamia's topic in AutoIt General Help and Support
You're the man! My mind is clearer now. except that : ReplaceString function to_ReplaceStringInFile("C:\path-to-folder-with-myfiles\" & $array[$i], "something", $array[$i]) to ReplaceString function to_ReplaceStringInFile("C:\path-to-folder-with-myfiles\" & $array2[$i], "something", $array[$i]) Anyway thanks. -
Hi, it's been awhile since i last coding. anyway, i have a list in a file in animal.txt. e.g cat dog chicken mouse then i want to use that list to replace string "something" in multiple files. e.g in mypet-1.txt i have a something. mypet-2.txt i have a something. mypet-3.txt i have a something. mypet-4.txt i have a something. Can somebody can come out with a simple script?
-
I really loving it because it perfectly run on my system on my first attempt to run this script!
-
I'm lovin it!
-
I'm lovin it!
-
Creating NoDrives Functions
mrmacadamia replied to mrmacadamia's topic in AutoIt General Help and Support
I'm so sorry if I didn't make myself very clear. So, what i'm trying to do is: 1. Launch the script and read all the available drives. 2. All drives assigned with each checkbox. 3. Checked box allow to hide drive.(change the registry value) 3a. If multiple drives selected, e.g: a: and e: drives, it should 1 + 16 = 17. So, the registry should be in 17 value which is RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDrives", "REG_DWORD", "17") -
I'm trying to create a script that could show and hide drive easily. It might be the same concept from this site but it just couldn't hide your drive automatically. http://www.wisdombay.com/hidedrive/index.php So far I created the script but couldn't figure it out how to add up each letter of the drive even I look the function of the site. It's javascript, so i don't know much about object thingy. anyway this is working code but still need a little work to do. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Ini = @ScriptDir & "\restore.ini" Global $Sect = "Current" ;================ ;This is the drive letter with it values ;=============== ;A: 1, B: 2, C: 4, D: 8, E: 16, F: 32, G: 64, H: 128, I: 256, J: 512, K: 1024, L: 2048, M: 4096, N: 8192, O: 16384, P: 32768, Q: 65536, R: 131072, S: 262144, T: 524288, U: 1048576, V: 2097152, W: 4194304, X: 8388608, Y: 16777216, Z: 33554432, ALL: 67108863 $ChkBox = DriveGetDrive( "all" ) If NOT @error Then MsgBox(4096,"", "Found " & $ChkBox[0] & " drives") EndIf $hGui = GUICreate("", 400, 405) For $i = 1 To UBound($ChkBox) - 1 $ChkBox[$i] = GUICtrlCreateCheckbox($ChkBox[$i], 5, ($i * 20) + 5, 80, 15) Next GUISetState() Load() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Save() Exit Case $ChkBox[1] To $ChkBox[UBound($ChkBox) - 1] Call(GUICtrlRead($Msg, 1)) EndSwitch WEnd Func Save() For $i = 1 To UBound($ChkBox) - 1 IniWrite($Ini, $Sect, GUICtrlRead($ChkBox[$i], 1), GUICtrlRead($ChkBox[$i])) Next $var = IniReadSection($Ini, $Sect) If @error Then Return Else For $j = 1 To $var[0][0] $Key = $var[$j][0] $NewValue = $var[$j][1] If $NewValue = 1 Then ;this is the place i supposed to have another function that could add up the value of each value of drives ConsoleWrite($Key & @CRLF) EndIf Next EndIf EndFunc Func Load() Local $aIRS If Not FileExists($Ini) Then Return $aIRS = IniReadSection($Ini, $Sect) If @error Then Return For $i = 1 To $aIRS[0][0] Local $Key = $aIRS[$i][0] Local $NewValue = $aIRS[$i][1] If $NewValue = 1 Then GUICtrlSetState($ChkBox[$i], 1) Call($aIRS[$i][0]) EndIf Next EndFunc ;==>Load
-
Getting Selected Item from Listview or Treeview
mrmacadamia replied to mrmacadamia's topic in AutoIt General Help and Support
That is totally genius wolf9228. Never thought that $items can play role in this situation. Don't have any idea what was the $items is all about, clueless. Eventhough I didn't ask to create other function, you kindly created and modified the _Remove() and the _PerformTask() function to suit the script. Thanks a lot. I owe you man. There's more things I need to learn here. Thanks. -
Getting Selected Item from Listview or Treeview
mrmacadamia replied to mrmacadamia's topic in AutoIt General Help and Support
I don't need to wait to be selected to perform the task. -
Hi guys, been looking around for days looking for solution but as always, doesn't found what I'm really looking. I try to get list from listview I created(actually, modified from jennico's script) and try to save it in .ini file. Anyway, I'm trying to build a script that I can select folders(not files) and perform task on all folders that being listed. I know I can use other method but I want to try and learn using listview instead. #include <date.au3> #include <string.au3> #include <IE.au3> #include <Base64.au3> #include <WinApi.au3> #include <Inet.au3> #include "CompInfo.au3" #include <File.au3> #include <Process.au3> #include <Crypt.au3> #include <Misc.au3> #include "GUIEnhance.au3" #include <GuiComboBox.au3> #include<GuiStatusBar.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <ListviewConstants.au3> #include <WindowsConstants.au3> #include <GuiImageList.au3> #include <GuiTreeView.au3> #include <GuiListView.au3> Global Const $pv = "PendingFileRenameOperations", $pe = "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" Global $iStyleJust = BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS) Global $title = "Setting", $item[1], $items = 0, $popup = 0, $start = 0, $listview Global $GUI $avi2 = GUICtrlCreateAvi("shell32.dll", 164, 160, 416, 300, 60) GUICtrlSetResizing(-1, 834) GUICtrlSetState(-1, 32) $label = GUICtrlCreateLabel("", 170, 422, 450, 54) GUICtrlSetResizing(-1, 582) _ChooseYourFolder() Func _ChooseYourFolder() $GUI = GUICreate($title & " c 2010 by Guugul", 492, 335, Default, Default, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $WS_SIZEBOX) GUICtrlSetFont(GUICtrlCreateGroup("Select your folder", 10, 15, 470, 255), 8.5, 800) GUICtrlSetResizing(-1, 550) $listview = GUICtrlCreateListView("x|x", 15, 30, 405, 220, $LVS_NOCOLUMNHEADER + $LVS_SINGLESEL + $LVS_SHOWSELALWAYS, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES); + $LVS_EX_CHECKBOXES) GUICtrlSetFont(-1, 8.5, 800) GUICtrlSetResizing(-1, 550) GUIRegisterMsg($WM_SIZE, "_WM_SIZE") $btnadd = GUICtrlCreateButton("Add", 425, 160, 50, 26) GUICtrlSetResizing(-1, 804) GUICtrlSetCursor(-1, 0) $btnremove = GUICtrlCreateButton("Remove", 425, 190, 50, 26) GUICtrlSetResizing(-1, 804) GUICtrlSetCursor(-1, 0) $btnPerform= GUICtrlCreateButton("Perform", 425, 230, 50, 26) GUICtrlSetFont(-1, 8.5, 800) GUICtrlSetResizing(-1, 804) GUICtrlSetCursor(-1, 0) $btnDoSave = GUICtrlCreateButton("OK", 275, 275, 100) $ReturnMenu = GUICtrlCreateButton("Cancel", 380, 275, 100) GUISetState() While 1 $gMsg = GUIGetMsg() If GUICtrlRead($listview) And GUICtrlGetState($btnremove) = 144 Then GUICtrlSetState($btnremove, 64) If GUICtrlRead($listview) = 0 And GUICtrlGetState($btnremove) = 80 Then GUICtrlSetState($btnremove, 128) Switch $gMsg Case $GUI_EVENT_CLOSE GUIDelete($GUI) ExitLoop Case $btnadd _Add() Case $btnremove _Remove() Case $btnPerform _PerformTask() Case $btnDoSave Exit Case $ReturnMenu GUIDelete($GUI) ExitLoop EndSwitch WEnd EndFunc Func _Add() $x = FileSelectFolder("Select directory to search", "", 0, "", $GUI) If $x = "" Or StringInStr($x, ":\") = 0 Then Return If StringRight($x, 1) = "\" Then $x = StringTrimRight($x, 1) For $j = 1 To $items $input = StringSplit(GUICtrlRead($item[$j - 1]), "|") If $input[0] > 1 And $x = $input[2] Then Return Next $items += 1 ReDim $item[$items] $item[$items - 1] = GUICtrlCreateListViewItem("|" & $x, $listview) ConsoleWrite($x & @CRLF); For $i = 1 To $items; this is the one i'm trying, instead of creating new value, it overwrite all value. IniWrite(@ScriptDir & "\test.ini", "FolderList", "FolderName" & "_" & $i, $x) Next EndFunc Func _Remove() $x = GUICtrlRead($listview) If $x > 0 Then GUICtrlDelete($x) For $j = 1 To $items $input = StringSplit(GUICtrlRead($item[$j - 1]), "|") If $input[0] = 3 Then Return Next GUICtrlSetTip($listview, "") EndFunc ;==>_Remove Func _PerformTask() ;This one doesn't be the problem, i can create myself ;read the ini files ;do something with all listed folders EndFunc Func _WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) $pos = WinGetClientSize($GUI) _GUICtrlListView_SetColumnWidth ($listview, 1, $pos[0] - 130) ;ControlMove($GUI, "", $listview, 5, 118, $pos[0] - 9, $pos[1] - 203) EndFunc ;==>_WM_SIZE Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Dim $tNMHDR = DllStructCreate($tagNMHDR, $ilParam), $iCode = DllStructGetData($tNMHDR, "Code") If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $listview Then ; If $iCode = $NM_DBLCLK Then Return _Open() If $iCode = $NM_RCLICK Then $popup = 1 Return 0 EndIf EndIf Return "GUI_RUNDEFMSG" EndFunc ;==>_WM_NOTIFY p/s: Don't bother the include files. I know it's a LOT. I'm too lazy to remove it.
-
I use windows xp japanese I'm trying to write encryption/descryption code. I tried with simple encrypt function that included by default Autoit also use the encryption function that I found within this forum. I tried to encrypt password or text or date. It can encrypt but it still doesn't decrypt correctly. Maybe it is a bug or not perform correctly on Japanese windows. Does anyone have this problem?
-
If _NowCalcDate() <> $LastRunDateCheck Then ;if the date is different to the last ran date then increase the days used by 1 $CountCheck += 1 Debug ("Increase the used count; Count is now " & $CountCheck) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("Count"),Encrypt ($CountCheck)) IniWrite ($myFakeDll,$dlliniSection,Encrypt ("LastRunDate"),Encrypt (_NowCalcDate()));log the new last run date EndIf For those who tried ChrisL's script. I just want to ask about the script. Might I be wrong but if a user doesn't use his/her computer for days, and the $CountCheck wouldn't increase right? Yes, this script still work because we already declared $finalDateCheck as when will the program will be expired.
-
lol, I thought there will be some code in Autoit to bring out the Run As dialog. Anyway thanks. I will find the other way because the vbs a little bit complicated for me to understand. thank you.
-
Anybody know how to code launch "Run As" dialog that originally can be execute by Windows Key + R rather using Send() function? thanks.
-
FileRead() not stopping at EOF
mrmacadamia replied to mrmacadamia's topic in AutoIt General Help and Support
I can't see any code that you mentioned in my script. edit... Ahh...the first one above. sorry.