Jump to content

wth

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by wth

  1. Thanks a lot for your help! Exactly what I need. I'm using Gui Events but now that I know how and when the control id is being sent I should be able to figure it out. Now it's time to debug this huge program I haven't worked on in 4 months to figure out why it still isn't working. haha
  2. Hi Everyone, I'm in the process of converting an Input into a Combo and can't figure out how to make the Focus change once a selection is made in the Combo. I used to have an Accel triggered by {ENTER} on the input to change focus to another input box. Thank you for any suggestions.
  3. Thanks for the help. Copying the obfuscator folder to a different place and running it manually works. I looked through the settings of Scite and saw one place to specify the obfuscator folder and changed that. However it looks like the log file placement may be hard coded. At least I couldn't find a place to make it match the exe. Thanks
  4. Hi there, I'm trying to use /striponly but it wont work with the following error... "Can't open file C:\Program Files\AutoIt3\SciTE\Obfuscator\\Obfuscator.Log" The file is in that location so my only guess is it has to do with permissions. I don't have admin rights on this computer but would like to use obfuscator to reduce the size of my scripts. Thanks for any help.
  5. Hi There, I'm using FileDelete() in a function and it is deleting the file but I must be trying to use the return incorrectly. Here is the function that I'm using. Func _main() Local $sPOFolder Local $aFilelist Local $i Local $cProgressBar $cProgressBar = ProgressOn("Copy Retail Text Files", "", "", 0, @DesktopHeight - 200) ProgressSet(0, "", "Starting copy files") If $cmdline[1] = "CFC" Then $sPOFolder = $sPACCRootCFC & "daily_po\" ElseIf $cmdline[1] = "SFC" Then $sPOFolder = $sPACCRootSFC & "daily_po\" EndIf $aFilelist = _FileListToArray($sPOFolder, $cmdline[2] & "*.txt") _ArrayDelete($aFilelist, 0) ProgressSet(0,"Files 0 of " & UBound($aFilelist) & " completed", "0 of " & UBound($aFilelist)) For $i = 0 to UBound($aFilelist) - 1 If Not $aFilelist[$i] = "" Then $sDestFolder = _getDestFolder($aFilelist[$i], $cmdline[1]) ProgressSet(Int(($i+1)/UBound($aFilelist)*100), "Copying " & $aFilelist[$i] & " to " &@CRLF& $sDestFolder &@CRLF& $aFilelist[$i], $i+1 & " of " & UBound($aFilelist)) FileCopy($sPOFolder & $aFilelist[$i], $sDestFolder & $aFilelist[$i], 1) Sleep(250) If FileExists($sDestFolder & $aFilelist[$i]) Then ProgressSet(Int(($i+1)/UBound($aFilelist)*100), "Deleting " & $aFilelist[$i], $i+1 & " of " & UBound($aFilelist)) Sleep(250) If FileDelete($sPOFolder & $aFilelist[$i]) = 0 Then MsgBox(0,"Error: " & @error, "This file was not deleted" &@CRLF& "Ensure that the Celerant that made the POs is closed."&@CRLF&@CRLF&"File attributes are: " & FileGetAttrib($sPOFolder&$aFilelist[$i])) EndIf Else MsgBox(0,"File not copied!!!", $aFilelist[$i] & " was not copied. Please report this error and verify that the file was in fact not copied.") EndIf EndIf Next ProgressOff() EndFunc It will delete the file but it's still showing the message that the file was not deleted. Thanks for any help!
  6. Thanks for your help!
  7. Thanks for your help. Along with adding this, I noticed that I wasn't getting every Excel Title either because only the Active Window would have Microsoft Excel - in the title. So I searched for .xls and then manually deleted the one with Microsoft Excel -. Now it seems to works. If I add a WinActivate($sTitle) before I do the ObjGet, will that reliably return the obj that is in control of $sTitle?
  8. I think I'll be able to use the selector to cut off the filename to specify the workbook. Then ActiveSheet might have better luck. Thanks. I used to have this set on my computer but I ran into issues because I'm not the only person running these. So now I try to code to our company's default install. The thing that is most confusing to me is why the _ExcelBookAttach doesn't fully work when I use the Full Title with Title as the second option as listed in the help file. Is there an easy way to get the path for the file from the Title? Thanks
  9. This may not be an issue attaching as much as it's an issue with it pulling the data from the correct workbook. I'm able to attach to the Object but the non active workbook is getting used. Here is the main file and the excel selector is below. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=..\ICQA\bin_switching.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Excel.au3> #include <GUIConstants.au3> #include <Misc.au3> #include "excelWindowSelector.au3" Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",2) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) AutoItSetOption("MustDeclareVars", 1) Global $cDelay, $cProgress, $cStart Global Const $xlUp = -4162 _main() Func _main() Local $hGui, $sMsg, $dll Local $iWidth = 300, $iHeight = 75 $dll = DllOpen("user32.dll") $hGui = GUICreate("Bin Switching", $iWidth, $iHeight, 0, @DesktopHeight - $iHeight - 60) WinSetOnTop("BinSwitching", "", 1) GUICtrlCreateLabel("Speed:", 10, 10, 35, 20) ;1 $cDelay = GUICtrlCreateCombo("Regular", 60, 10, 80, 20) GUICtrlSetData(-1, "Slow", "Regular") $cStart = GUICtrlCreateButton("Start", 160, 10, 80, 20) $cProgress = GUICtrlCreateLabel("", $iWidth/4, 40, $iWidth/2, 20) GUISetState(@SW_SHOW) While 1 Sleep(15) $sMsg = GUIGetMsg() If _IsPressed("1B", $dll) Then TrayTip("", "User aborted process", 5) ExitLoop EndIf Switch $sMsg Case $GUI_EVENT_CLOSE Exit Case $cStart _binSwitch() EndSwitch WEnd EndFunc Func _binSwitch() Local $oExcel, $iRow, $iColumn, $aData, $i, $iNumItems, $sTitle $sTitle = _getExcelWindow() If $sTitle = -1 Then Exit EndIf $iColumn = InputBox("Starting Column", "Please enter the number of the starting cell's column." &@CRLF&@CRLF& _ "For Column A, you would enter 1. For Column B, you would enter 2", 1) If Not $iColumn > 0 Then Return -1 EndIf $iRow = InputBox("Starting Row", "Please enter the starting row", 1) If Not $iRow > 0 Then Return -1 EndIf $oExcel = _ExcelBookAttach($sTitle, "Title") If Not IsObj($oExcel) Then MsgBox(0,"Error", "Could not attach to Excel Window: " & $sTitle) Exit EndIf $iNumItems = $oExcel.Activesheet.cells(65535, Int($iColumn)).End($xlUp).Row - Int($iRow) + 1 For $i = 0 To $iNumItems-1 GUICtrlSetData($cProgress, "Switching: "&$i+1&" of "&$iNumItems) $aData = _ExcelReadArray($oExcel, Int($iRow+$i), Int($iColumn), 2) _singleBinSwitch($aData[0], $aData[1]) _sleep(1500) Next SoundPlay("C:\WINDOWS\media\Windows XP Print complete.wav") EndFunc Func _singleBinSwitch($sSku, $sLocation) oracleActivate() Send($sSku) _sleep(1000) Send("^{F11}") _sleep(1000) Send("+{PGDN}") _sleep(2000) Send("^{UP}") _sleep(2000) Send("{ENTER}") _sleep(1000) Send($sLocation) _sleep(1000) Send("+{PGUP}") _sleep(1000) Send("^s") _sleep(1000) Send("{F11}") EndFunc Func oracleActivate() Local $oracle $oracle = "Oracle Applications - Production" If Not WinActive($oracle,"") Then WinActivate($oracle,"") WinWaitActive($oracle,"") sleep(1000) EndFunc Func _sleep($iTime) If GUICtrlRead($cDelay) = "Slow" Then $iTime = $iTime * 2 EndIf Sleep($iTime) EndFunc Excel selector: #include <Array.au3> #include <GUIListBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> AutoItSetOption("MustDeclareVars", 1) ;_getExcelWindow() Func _getExcelWindow() Local $aWindows, $i, $sMsg Local $hGUI, $hListBox, $cOK Local $iWidth = 300, $iHeight = 175 Local $sReturn $aWindows = WinList() $i=0 While $i <= UBound($aWindows) - 1 If Not StringInStr($aWindows[$i][0], "Microsoft Excel - ") > 0 Then _ArrayDelete($aWindows, $i) Else $i = $i + 1 EndIf WEnd ; Create GUI $hGUI = GUICreate("Select window", $iWidth, $iHeight) $hListBox = _GUICtrlListBox_Create($hGUI, "", 2, 2, $iWidth-4, $iHeight - 24) $cOK = GUICtrlCreateButton("Ok", $iWidth - 32, $iHeight - 22, 30, 20) GUISetState() ; Add files _GUICtrlListBox_BeginUpdate($hListBox) _GUICtrlListBox_ResetContent($hListBox) _GUICtrlListBox_InitStorage($hListBox, 100, 4096) For $i = 0 to UBound($aWindows) - 1 _GUICtrlListBox_AddString($hListBox, $aWindows[$i][0]) Next _GUICtrlListBox_EndUpdate($hListBox) ; Loop until user exits While 1 $sMsg = GUIGetMsg() Switch $sMsg Case $GUI_EVENT_CLOSE GUIDelete($hGUI) $sReturn = -1 ExitLoop Case $cOK If _GUICtrlListBox_GetCurSel($hListBox) <> - 1 Then $sReturn = _GUICtrlListBox_GetText($hListBox, _GUICtrlListBox_GetCurSel($hListBox)) ExitLoop Else TrayTip("", "Please select a window", 3) EndIf EndSwitch WEnd GUIDelete() Return $sReturn EndFunc Another part of the issue is that if Excel shares the main DDE with another workbook, only one of the titles is shown in the selector. I'm not exactly sure what I should do to fix this and would appreciate any suggestions. Thanks
  10. Absolutely Correct! It took me longer to create that post then it did for you to tell me what I did wrong. ) Thanks!
  11. Hi There, I've written this script but FileDelete isn't working all of the time. Today, 2 out of 10 were deleted. All of the files it is trying to delete it has access to. The filegetattrib only return "A" for those it cannot delete. All of the files are created at the same time through excel about 7 hours ago. _main() Func _main() Local $sPOFolder Local $aFilelist Local $i Local $cProgressBar Local $aIndices[2] $cProgressBar = ProgressOn("Copy Retail Text Files", "", "", 0, @DesktopHeight - 200) ProgressSet(0, "", "Starting copy files") If $cmdline[1] = "CFC" Then $sPOFolder = $sPACCRootCFC & "daily_po\" ElseIf $cmdline[1] = "SFC" Then $sPOFolder = $sPACCRootSFC & "daily_po\" EndIf $aFilelist = _FileListToArray($sPOFolder, $cmdline[2] & "*.txt") _ArrayDelete($aFilelist, 0) ProgressSet(0,"Files 0 of " & UBound($aFilelist) & " completed", "0 of " & UBound($aFilelist)) For $i = 0 to UBound($aFilelist) - 1 If Not $aFilelist[$i] = "" Then $sDestFolder = _getDestFolder($aFilelist[$i], $cmdline[1]) ProgressSet(Int(($i+1)/UBound($aFilelist)*100), "Copying " & $aFilelist[$i] & " to " &@CRLF& $sDestFolder &@CRLF& $aFilelist[$i], $i+1 & " of " & UBound($aFilelist)) FileCopy($sPOFolder & $aFilelist[$i], $sDestFolder & $aFilelist[$i], 1) Sleep(2000) If FileExists($sDestFolder & $aFilelist[$i]) Then ProgressSet(Int(($i+1)/UBound($aFilelist)*100), "Deleting " & $aFilelist[$i], $i+1 & " of " & UBound($aFilelist)) FileDelete($sPOFolder & $aFilelist[$i]) If @error = 0 Then MsgBox(0,"Error: " & @error, "This file was not deleted" &@CRLF& "File attributes are: " & FileGetAttrib($sPOFolder&$aFilelist[$i])) EndIf Else MsgBox(0,"File not copied!!!", $aFilelist[$i] & " was not copied. Please report this error and verify that the file was in fact not copied.") EndIf EndIf Next ProgressOff() EndFunc I left out the _getdestfolder and global variables. They are all or return folder paths with a \ at the end. Any suggestions? Thanks,
  12. Hi, just to make sure that I wrote this correctly. I added... Dim $hWin $hWin = WinGetHandle("name") While dllCall("User32.dll", "BOOLEAN", "IsHungAppWindow", "HINSTANCE", $hWin) Sleep(1) Wend This didn't work but it doesn't mean that it's written correctly. I don't know how to force a window to be unresponsive so it's a bit difficult to test.
  13. Hi, this worked perfectly. Thanks! I'll take a look at IsHungAppWindow because that would probably be a cleaner solution if it works.
  14. The titling no but I could probably use pixel color of something. I had to do that at another point in the macro, didn't think to try it here. The window goes completely blank when unresponsive so I'll find a point when it's good and test. I'll let you know if it works. Thanks!
  15. Hi There, I'm writing a script for a java program and at one part I have to wait for it to scan some items. I'm using Not Winexist() to wait for the window to disappear. This is working correctly. The issue that I'm having is that the main screen it returns to is now active but not responding so WinWaitActive doesn't work. Unfortunately the not responding can be from 7 seconds to 7 minutes. Is there anything I can do to check for window responsiveness or will I be stuff with a 10 minute sleep to buy it plenty of time to respond?
×
×
  • Create New...