Jump to content

stampy

Active Members
  • Posts

    239
  • Joined

  • Last visited

Everything posted by stampy

  1. To read the file to an array you can use _FileReadToArray. Once the lines are in the array you can edit/delete as needed. Then you can write back to the file with _FileWriteFromArray.
  2. Please post some sample code that we can look at.
  3. Thank you I'll take a look.
  4. Maybe I'm missing this but....... I am in need of getting the window and control info from a user. I'd love to just run it on my machine and run au3info.exe. But I can't. I'd love to give them au3info.exe and say just record the info for me... however they seem to not understand how a phone works let alone a computer. so........ I'd like to run a script that can capture the information as they do it. First of all I'm stuck on how to get the info of the control that they are over... just like au3info.exe does. Can anyone guide me as to how to get the control info. (it seems like I'm missing something real real basic here.)
  5. Welcome to the forums. Look in the help file for PixelGetColor. That should get you started.
  6. When I use the following code on a window for a installer, the first three commands work with no problem. GetItemCount = 1, correct. GetSubItemCount = 4, correct. GetSelected = 0, correct (0 based and there is only one) However, when I use the "GetText" command to read the subitems in the row, the results are all blank. I've tried it as shown with a variable. I've tried it with static numbers. I've tried to replace it with the handle (that shouldn't matter since the previous lines all work with the SysListView32). Always I get a blank result. What am I missing? MsgBox(0, "item count", ControlListView('Install', "Select the target printer and press the [OK] button.", "SysListView321", "GetItemCount") ) MsgBox(0, "sub item count", ControlListView('Install', "Select the target printer and press the [OK] button.", "SysListView321", "GetSubItemCount") ) $ret = ControlListView('Install', "Select the target printer and press the [OK] button.", "SysListView321", "GetSelected") MsgBox(0, "selected", $ret) For $i = 0 to 3 MsgBox(0, $i, ControlListView('Install', "Select the target printer and press the [OK] button.", "SysListView321", "GetText", $ret, $i) ) Next
  7. A ) why would you want to use the startup dir and the reg / run ??? Should be one or the other. B ) your telling it the file name as the value name. You need to move it over to the value. RegWrite('HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'MyRunFile', "REG_SZ", @StartupDir & "\xxxx.exe")
  8. I understand. Perhaps a ControlCommand with the getSelected will work. It's hard to know as I don't know what kind of control it is. You mentioned a Ctrl-A won't work how about a shift-end and delete? Just trying to think outside the box and make it work.
  9. As we can not see it, perhaps breaking it down... your first line under "problem code" is to click in the field you need (I presume). Is it doing that? Then you ask it to send text that is a subject is it doing that?
  10. Missed one ampersand. $Label3 = GUICtrlCreateLabel( "Example: " & $aufl & "and" & $aufl2, 456, 376, 180, 17)
  11. You can simply read the msg from the combo itself to know it's been triggered. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ComboConstants.au3> Global $Barcode0, $Barcode1, $Barcode2, $Barcode3, $Barcode4 Global $Status0, $Status1, $Status2, $Status3, $Status4, $Status Global $ItemName0, $ItemName1, $ItemName2, $ItemName3, $ItemName4 Global $ItemCost0, $ItemCost1, $ItemCost2, $ItemCost3, $ItemCost4 $Typeness = 1 GUICreate(" Reciept Generator", 400, 600, -1, -1) $StoreNames = GUICtrlCreateLabel("The Computer Store", 0, 10, 300, 20, $SS_CENTER) GUICtrlSetFont(-1, 12, 600, 4, "Calibri") #Region Barcode GUICtrlCreateLabel("Barcode No.", 10, 150, 75, 15) $Barcode0 = GUICtrlCreateCombo("", 10, 170, 75, 20, $CBS_DROPDOWNLIST) $Barcode1 = GUICtrlCreateCombo("", 10, 200, 75, 20, $CBS_DROPDOWNLIST) $Barcode2 = GUICtrlCreateCombo("", 10, 230, 75, 20, $CBS_DROPDOWNLIST) $Barcode3 = GUICtrlCreateCombo("", 10, 260, 75, 20, $CBS_DROPDOWNLIST) $Barcode4 = GUICtrlCreateCombo("", 10, 290, 75, 20, $CBS_DROPDOWNLIST) #EndRegion Barcode #Region Item Name GUICtrlCreateLabel("Item Name", 100, 150, 100, 15) $Item0 = GUICtrlCreateLabel("", 100, 172, 100, 15) $Item1 = GUICtrlCreateLabel("", 100, 202, 100, 15) $Item2 = GUICtrlCreateLabel("", 100, 232, 100, 15) $Item3 = GUICtrlCreateLabel("", 100, 262, 100, 15) $Item4 = GUICtrlCreateLabel("", 100, 292, 100, 15) #EndRegion Item Name #Region Cost GUICtrlCreateLabel("Cost", 210, 150, 50, 15) $Cost0 = GUICtrlCreateLabel("", 210, 170, 50, 15) $Cost1 = GUICtrlCreateLabel("", 210, 200, 50, 15) $Cost2 = GUICtrlCreateLabel("", 210, 230, 50, 15) $Cost3 = GUICtrlCreateLabel("", 210, 260, 50, 15) $Cost4 = GUICtrlCreateLabel("", 210, 290, 50, 15) #EndRegion Cost #Region Quantity GUICtrlCreateLabel("Qty.", 270, 150, 25, 15) $Qty0 = GUICtrlCreateCombo("", 270, 170, 40, 20, $CBS_DROPDOWNLIST) $Qty1 = GUICtrlCreateCombo("", 270, 200, 40, 20, $CBS_DROPDOWNLIST) $Qty2 = GUICtrlCreateCombo("", 270, 230, 40, 20, $CBS_DROPDOWNLIST) $Qty3 = GUICtrlCreateCombo("", 270, 260, 40, 20, $CBS_DROPDOWNLIST) $Qty4 = GUICtrlCreateCombo("", 270, 290, 40, 20, $CBS_DROPDOWNLIST) #EndRegion Quantity #Region Price GUICtrlCreateLabel("Price", 320, 150, 50, 15) $Price0 = GUICtrlCreateLabel("", 320, 170, 50, 15) $Price1 = GUICtrlCreateLabel("", 320, 200, 50, 15) $Price2 = GUICtrlCreateLabel("", 320, 230, 50, 15) $Price3 = GUICtrlCreateLabel("", 320, 260, 50, 15) $Price4 = GUICtrlCreateLabel("", 320, 290, 50, 15) #EndRegion Price GUISetState(@SW_SHOW) GetCodes() Do $msg = GUIGetMsg() ManageAll($msg) Until $msg = $GUI_EVENT_CLOSE Func ReadCode($Type) If $Type = 0 Then $Status0 = GUICtrlRead($Barcode0) $ItemName0 = IniRead("Database.ini", "Items", $Status0, "") $ItemCost0 = IniRead("Database.ini", "Costs", $Status0, "") GUICtrlSetData($Item0, $ItemName0) GUICtrlSetData($Cost0, $ItemCost0) ElseIf $Type = 1 Then $Status1 = GUICtrlRead($Barcode1) $ItemName1 = IniRead("Database.ini", "Items", $Status1, "") $ItemCost1 = IniRead("Database.ini", "Costs", $Status1, "") GUICtrlSetData($Item1, $ItemName1) GUICtrlSetData($Cost1, $ItemCost1) ElseIf $Type = 2 Then $Status2 = GUICtrlRead($Barcode2) $ItemName2 = IniRead("Database.ini", "Items", $Status2, "") $ItemCost2 = IniRead("Database.ini", "Costs", $Status2, "") GUICtrlSetData($Item2, $ItemName2) GUICtrlSetData($Cost2, $ItemCost2) ElseIf $Type = 3 Then $Status3 = GUICtrlRead($Barcode3) $ItemName3 = IniRead("Database.ini", "Items", $Status2, "") $ItemCost3 = IniRead("Database.ini", "Costs", $Status2, "") GUICtrlSetData($Item3, $ItemName3) GUICtrlSetData($Cost3, $ItemCost3) ElseIf $Type = 4 Then $Status4 = GUICtrlRead($Barcode4) $ItemName4 = IniRead("Database.ini", "Items", $Status2, "") $ItemCost4 = IniRead("Database.ini", "Costs", $Status2, "") GUICtrlSetData($Item4, $ItemName4) GUICtrlSetData($Cost4, $ItemCost4) EndIf EndFunc ;==>ReadCode Func GetCodes() $Barcodes = IniRead("Database.ini", "General", "Barcodes", "") GUICtrlSetData($Barcode0, $Barcodes) GUICtrlSetData($Barcode1, $Barcodes) GUICtrlSetData($Barcode2, $Barcodes) GUICtrlSetData($Barcode3, $Barcodes) GUICtrlSetData($Barcode4, $Barcodes) EndFunc ;==>GetCodes Func ManageAll($msg) Select Case $msg = $Barcode0 GUICtrlSetData($Item0, IniRead('Database.ini', 'Items', GUICtrlRead($Barcode0), '')) Case $msg = $Barcode1 GUICtrlSetData($Item1, IniRead('Database.ini', 'Items', GUICtrlRead($Barcode1), '')) Case $msg = $Barcode2 GUICtrlSetData($Item2, IniRead('Database.ini', 'Items', GUICtrlRead($Barcode2), '')) Case $msg = $Barcode3 GUICtrlSetData($Item3, IniRead('Database.ini', 'Items', GUICtrlRead($Barcode3), '')) Case $msg = $Barcode4 GUICtrlSetData($Item4, IniRead('Database.ini', 'Items', GUICtrlRead($Barcode4), '')) EndSelect EndFunc ;==>ManageAll
  12. Your run command is correct and should work. I'm not sure why it's not. However, your trying to read out of a file, try something like this... $hFile = FileOpen("C:\Documents and Settings\dtpstaff\Desktop\DeleteAfterScriptFinishes.txt",0) $sFileText = FileRead($hFile) FileClose($hFile) ;now search your text for 'First Name' $pos = StringInStr($sFileText,'First Name') +10 ;get the position of First String - add 10 for the lenth of the search string ;read everything after 'First Name' $newTxt = StringRight($sFileText,StringLen($sFileText)-$pos)
  13. Look into StringStripWS
  14. While I'm presuming that the 0001 would go beyond and this code wouldn't work, this sample for loop should give you an idea of how the repetition can be used in a loop. For $i = 1 to 3 $Title = _GetTitle("D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\000"&$i&".txt") ;MsgBox(0,'',$Title) sleep(3000) FileMove("D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\christmas greetings\index"&$i&".htm", "D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\christmas greetings\"&$title&".htm",1) sleep(3000) Next Func _GetTitle($File) $text = FileRead($File) $posStart = StringInStr($text,'<title>') $posEnd = StringInStr($text,'</title>') If $posStart = 0 or $posEnd = 0 Then MsgBox(0,'ERROR','This File doesnt Contain a Title') $result = '' ; This File doesnt Contain a Title Else $result = StringMid($text,$posStart+7,$posEnd-($posStart+7)) EndIf $result= StringLower($result) Return $result EndFunc Func _SendTitle($Title) Sleep(250) ControlSend("Notepad",'','', String($Title)) ControlSend('[Class:Notepad]', '', 'Edit1', $Title) Sleep(250) EndFunc
  15. I'm not familiar with Plink at all. However it sounds as if your looking to build a GUI that would allow you to selected a login and go. (a one click solution). It seems as if the command file is needed for the login, but I see no reason the file couldn't be produced on the fly to login. Perhaps using a listbox or combo box for the gui list then using one of the fileopen/ filewrite /filewriteline to write the temp command file and then delete is when done. Seems completely possible. I'd start with one of the sample GUI's from the help file and build on it from there.
  16. Your right the error catch wouldn't allow the second one. I also saw that the current policy was being set wrong. However, turns out I pasted the wrong code. I changed it with no error catching to make sure I tested it right and the following didn't work either. Func SetUserPowercfg2() RegWrite("HKEY_CURRENT_USER\Control Panel\PowerCfg", "CurrentPowerPolicy", "REG_SZ", "2") RegWrite('HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\2', 'Policies', 'REG_BINARY', _ '0100000000000000010000000000000000000000000000000000' & _ '000000000000000000003232000001000000010000006c000000' & _ '43003a00000000002c01000000000000580200000000646464646500') MsgBox(0,'','done') EndFunc
  17. That would be nice. Powercfg.exe does everything I would need it to... except work with windows 2k >>> http://support.microsoft.com/kb/888742 Edit: And yes, full control, local computers with administrator priv.
  18. I'm trying to create a setup script for many different computers. One thing it will need to do is to set the power settings to not turn off the monitor or hard drives. I've succeeded in setting the name of the scheme but nothing seems to actually change the monitor/hdd settings. I've found a few examples using powercfg.exe. However some of the systems are Windows XP and some are Windows 2k. Powercfg.exe does not work on 2k. I found this link: http://www.autoitscript.com/forum/index.php?showtopic=10218&st=0&p=71350&hl=setting%20power%20schemes&fromsearch=1&#entry71350 I tried this and it still doesn't change the settings on 2k (I haven't tried on xp yet). When I change to the needed settings. Then export the reg file. Then change them to something else. Then import the reg file... it doesn't change the settings either. Am I looking in the wrong area? How can I accomplish this simple task in Windows 2k? Any advice is greatly appreciated. SetUserPowercfg() Func SetUserPowercfg() RegWrite("HKEY_CURRENT_USER\Control Panel\PowerCfg", "CurrentPowerPolicy", "REG_SZ", "2") If @error Then Return 0 Else Return 1 EndIf RegWrite('HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\2', 'Policies', 'REG_BINARY', _ '0100000000000000010000000000000000000000000000000000' & _ '000000000000000000003232000001000000010000006c000000' & _ '43003a00000000002c01000000000000580200000000646464646500') If @error Then Return 0 Else Return 1 EndIf EndFunc ;==>SetUserPowercfg
  19. I'm thinking you want If $I_PixH <> $I_PixelColor Then rather than less than or equal.
  20. ControlGetText() will get the text of the control. However it seems better to just store it as you've already read it from the ini.
  21. Very little chance it's going to test it at exactly 3 seconds.
  22. $checkboxer needs defined first. The only place it is ever set is in one of the case statements. So when the other case is true it goes to use $checkboxer and it's not been defined/declared.
  23. If your just trying to read the content it's FileRead() $file = FileOpen("C:\Documents and Settings\Pablo\Mis documentos\TEST.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $fileContent = FileRead($file) FileClose($file) MsgBox(0,'',$fileContent)
  24. I don't understand what this is suppose to do: send("{LWIN}") sleep(200) send("C:\Users\Blake\Desktop\l2 stuff\L2 net\L2NET.exe") sleep(100) send("{enter}") What problems are you actually having with the script?
  25. ok... patience... ummm.... ummm... (chanting for relaxation) ... umm.... This is incorrect : While 1=1 ;<<<<<<<<<<<<<<<<<<<<<<<<<< send ("b") Sleep(500) Wend
×
×
  • Create New...