Jump to content
Sign in to follow this  
ashah

Windows 7 issue

Recommended Posts

ashah

Hello. Sorry for asking a stupid question but I have zero experience with AutoIt. An ex-employee made an interface using AutoIt 3.2.12. It basically pulls information from excel files and displays them on this interface which you can play with. Everything seems to be working ok except, when you rigth click a record it is supposed to open another box\applet with different options. This box opens fine in Windows XP but its not in Windows 7. I found the location of the source file, or atleast I think it is a source file. The extension is .au3. There is also a .qah file and the .exe. Can anyone help with this? Is there something I can install so this works on Windows 7. Thanks.

Asif Shah

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Version 3.2.12 is quite an old version.

If you can post the code (the .au3 file) we can have a look at it.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ashah

Thanks for the reply.

Can I attach here or should I just paste the code?

Share this post


Link to post
Share on other sites
water

It depends on the size of the code.

I'm not 100% sure but IIRC you need to have at least 5 posts before you can attach a file.

When you paste the code make sure to put it betwenn AutoIt tags: [autoit][/autoit]

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ashah

code was pasted here...now removed...

Edited by ashah

Share this post


Link to post
Share on other sites
ashah

;)

that prolly wasnt what you asked for....sorry...

Share this post


Link to post
Share on other sites
water

Looks like the ExcelCOM UDF (User Defined Functions).

Can you please Edit your post and remove the pile of code?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ashah

I removed the code. Any suggestions?

Share this post


Link to post
Share on other sites
water

What you posted is a function library to make working with Excel easier. What we need is the script your ex-employee coded which calls the _Excel* functions.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ashah

[autoit]

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=ampac.ico

#AutoIt3Wrapper_outfile=QAHoldDatabase.exe

#AutoIt3Wrapper_UseUpx=n

#AutoIt3Wrapper_UseAnsi=y

#AutoIt3Wrapper_Res_Description=QA Database for EGV

#AutoIt3Wrapper_Res_Fileversion=1.2.0.0

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; ------------------------------------------------------------------------------

; AutoIt Version: 3.2.12

; Description: QA Database for Elk Grove Village

; Author: Bob Flaherty

; Created: December 2008

; Versuin 1.1 Fixed issue with number roll-over

; Version 1.2 Added Action Required to New Record

; Added separate fields for rolls and boxes

; Added Customer PO number field

; Changed the report to handle the new fields

; Changed Hold Tag for separate boxes and rolls fields

; ------------------------------------------------------------------------------

;CREATE TABLE Data (QA_Hold_Number TEXT, Defect_Description TEXT, Date_Entered NUMERIC, QCTech NUMERIC, Machine TEXT, Supplier TEXT, Customer TEXT, Product_Name TEXT, Customer_Order_Number TEXT, Ampac_Skid_Number TEXT, Ampac_Lot_Number TEXT, Quantity NUMERIC, Units TEXT, Disposition TEXT, Status TEXT, ImmediateAction TEXT, QADisposition TEXT, Notes TEXT, Customer_PO TEXT, Affected_Boxes TEXT)

#Region INCLUDES and OPTIONS

;Includes

#include-once

#include <SQLite.au3>

#include <SQLite.dll.au3>

;#include <Array.au3> ;included in SQLite.au3

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <ListviewConstants.au3>

#include <GuiListView.au3>

#include <StaticConstants.au3>

#include <EditConstants.au3>

#include <ExcelCOM_UDF.au3>

#Include <GuiComboBox.au3>

#include <GuiListView.au3>

;Options

Opt("MustDeclareVars", 1)

Opt("GUICloseOnESC",0)

#EndRegion

#Region CONSTANTS AND VARIABLES

Global Const $MY_DATABASE = @ScriptDir & 'egv.qah '

Global Const $MY_INI = @ScriptDir & 'english.ini'

Global Const $MY_SCREENWIDTH = @DesktopWidth

Global Const $MY_SCREENHEIGHT = @DesktopHeight-32

Global Const $MY_WINTITLE = INIRead($MY_INI,"Others","WindowTitle","") & ' v. '& IniRead($MY_INI,"Others","Version","")

Global $iTrack, $iFirst, $dir, $TrackDir, $bDoubleClicked=FALSE

Global $hFile, $hLVItems, $hRadio[3], $bExportFlag=FALSE

Global $sTableHeader, $sLastSheet, $bSaveFlag, $sSupplier, $sDefects

Local $nMsg, $nTemp, $nDiff, $nTempID, $nPos, $nTemp1, $nTemp2, $nCID, $bFlag, $bOneSupplier

Local $sTemp, $sOld, $sPos, $iRow, $iCol, $sSupplierName, $arResult, $sResult, $sDate, $oBook

Local $nSupplierCount, $nBookCount, $sFirstBook, $sSaveName,$hSplashScreen

Dim $arSuppliers, $hSupplierTab, $arTemp, $hMenu, $hButtons, $arDefectCodes

#EndRegion

#Region INITIALIZATION

If NOT FileExists($MY_INI) Then

MsgBox(0,"File Missing","An INI file is missing."&@CRLF&'Error Code: 0')

Exit

EndIf

If NOT FileExists($MY_DATABASE) Then

MsgBox(0,"Database Missing","The database file is missing."&@CRLF&'Error Code: 1')

Exit

EndIf

;SQLite StartUp

_SQLite_Startup ()

If @error > 0 Then

;error initilizing SQLite

EndIf

$hFile = _SQLite_Open($MY_DATABASE)

If @error > 0 Then

;error opening database

EndIf

;Supplier Database

$arSuppliers=IniReadSection($MY_INI,"Suppliers") ;supplier list from INI file

If NOT IsArray($arSuppliers) Then

MsgBox(0,"INI Corrupt","The INI file is corrupt."&@CRLF&"Error Code: 15")

Exit

EndIf

_arraysort($arDefectCodes,0,2,0,1)

$sDefects=''

For $nCount = 2 to UBound($arDefectCodes)-1

$sDefects&=$arDefectCodes[$nCount][1]

If $nCount <> UBound($arDefectCodes)-1 Then $sDefects&='|'

Next

;Check for FDYear and reset if necessary

_SQLite_GetTable($hFile,"SELECT * FROM 'Preferences' WHERE Pref = 'FDYear';",$arResult,$iRow,$iCol)

If $arResult[$arResult[0]] <> @YEAR Then

_SQLite_Exec($hFile,"UPDATE Preferences SET PrefValue ='"&@YEAR&"' WHERE Pref = 'FDYear';")

_SQLite_Exec($hFile,"UPDATE Preferences SET PrefValue = '1' WHERE Pref = 'NextFDNo';")

$sFDetNum=StringRight(@YEAR,2)&'-0001'

EndIf

;end

$arTemp=0

$arTemp=IniReadSection($MY_INI,"NewRecord")

If NOT IsArray($arTemp) Then

MsgBox(0,"INI Corrupt","The INI file is corrupt."&@CRLF&"QA Hold Tag #"&$sOldNumber&' printed.','&Okay',$hNewRecord,200,75)

EndIf

EndSwitch

WEnd

GUISetState(@SW_ENABLE,$hMain)

GUIDelete($hNewRecord)

EndFunc ;=> _AddNewRecord

Func _PopulateListView($sSupplierName)

Local $sStatus='', $sTemp

If $sSupplierName = "Custom View" Then

$arResult=0

_SQLite_GetTable2d($hFile,"SELECT PrefValue FROM Preferences WHERE Pref='CustomSQLite'",$arResult,$iRow,$iCol)

$sTemp=$arResult[1][0]

$arResult=0

_SQLite_GetTable2d($hFile,$sTemp,$arResult,$iRow,$iCol)

Else

If GUICtrlRead($hRadio[1])=$GUI_CHECKED Then $sStatus="' AND Status='Open"

If GUICtrlRead($hRadio[2])=$GUI_CHECKED Then $sStatus="' AND Status='Closed"

_SQLite_GetTable2d($hFile,"SELECT * FROM Data WHERE (Supplier = '"&$sSupplierName&$sStatus&"');",$arResult,$iRow,$iCol)

EndIf

If $iRow > 0 Then

Dim $hLVItems[$iRow][2]

For $nCount=1 To $iRow

$sTemp=''

For $nPos=0 To $iCol-1

If ($nPos <> 3 AND $nPos <> 5 AND $nPos < 15) Then ;QA_Tech, Supplier - 15,16,17 are ImmediateAction, QADisposition, and Notes

If $nPos = 2 Then ;date

$sDate=StringLeft($arResult[$nCount][2],4)

$arResult[$nCount][2]=StringReplace($arResult[$nCount][2],$sDate,'')

$sDate=StringLeft($arResult[$nCount][2],2)&'/'&StringRight($arResult[$nCount][2],2)&'/'&$sDate

$sTemp&=$sDate

Else

$sTemp&=$arResult[$nCount][$nPos]

EndIf

If $nPos <> $iCol-1 Then $sTemp&='|'

EndIf

Next

$hLVItems[$nCount-1][0]=GUICtrlCreateListViewItem($sTemp,$hListView)

$hLVItems[$nCount-1][1]=$arResult[$nCount][0]

Next

EndIf

EndFunc ;=> _PopulateListView

Func _TabUpdate()

Local $nCount

Local $nTemp=GUICtrlRead($hTab,1)

Local $sTemp=$hSupplierTab[_ArraySearch($hSupplierTab,$nTemp)][1];Database name of selected tab

If IsArray($hLVItems) Then ;delete the array and elements

For $nCount=0 To UBound($hLVItems)-1

GUICtrlDelete($hLVItems[$nCount][0])

Next

$hLVItems=0

EndIf

_PopulateListView($sTemp)

EndFunc ;=> _TabUpdate

Func _PrintQAHoldTag($arResult)

Local $hPrntExprt=_ShowExportingSplashScreen()

Local $s1,$s2,$s3, $s4, $s5, $s6

If StringLen($arResult[13]) > 16 Then

$s1=StringLeft($arResult[13],16)

$arResult[13]=StringReplace($arResult[13],$s1,'')

If StringLen($arResult[13]) > 16 Then

$s2=StringLeft($arResult[13],16)

$s3=StringReplace($arResult[13],$s2,'')

Else

$s2=$arResult[13]

$s3=''

EndIf

Else

$s1=$arResult[13]

$s2=''

$s3=''

EndIf

If StringLen($arResult[19]) > 16 Then

$s4=StringLeft($arResult[19],16)

$arResult[13]=StringReplace($arResult[19],$s4,'')

If StringLen($arResult[19]) > 16 Then

$s5=StringLeft($arResult[19],16)

$s6=StringReplace($arResult[19],$s5,'')

Else

$s5=$arResult[19]

$s6=''

EndIf

Else

$s4=$arResult[19]

$s5=''

$s6=''

EndIf

Local $sOrigDate=$arResult[2]

$sDate=StringLeft($sOrigDate,4)

$sOrigDate=StringReplace($sOrigDate,$sDate,'')

$sDate=StringLeft($sOrigDate,2)&'/'&StringRight($sOrigDate,2)&'/'&$sDate

Local $oPrintSheet=_CreatePrintTag()

_ExcelWriteCell($oPrintSheet,'#'&$arResult[0],"G1") ;Hold Number

_ExcelWriteCell($oPrintSheet,$arResult[1],"B9") ;Defect Description

_ExcelWriteCell($oPrintSheet,$sDate,"B3") ;Date Entered

_ExcelWriteCell($oPrintSheet,$arResult[3],"F8") ;QC Tech

_ExcelWriteCell($oPrintSheet,$arResult[4],"F3") ;Machine

_ExcelWriteCell($oPrintSheet,$arResult[5],"B4") ;Supplier

_ExcelWriteCell($oPrintSheet,$arResult[6],"B5") ;Customer

_ExcelWriteCell($oPrintSheet,$arResult[7],"B6") ;Product Name

_ExcelWriteCell($oPrintSheet,$arResult[8],"B7") ;Customer Order Nubmer

_ExcelWriteCell($oPrintSheet,$arResult[18],"B8") ;Customer PO Number

_ExcelWriteCell($oPrintSheet,$arResult[10],"F6") ;Lot Number

_ExcelWriteCell($oPrintSheet,$arResult[11],"F7") ;Quantity

_ExcelWriteCell($oPrintSheet,$arResult[12],"G7") ;Units

_ExcelWriteCell($oPrintSheet,$s1,"E10")

_ExcelWriteCell($oPrintSheet,$s2,"E11")

_ExcelWriteCell($oPrintSheet,$s3,"E12")

_ExcelWriteCell($oPrintSheet,$s4,"g10")

_ExcelWriteCell($oPrintSheet,$s5,"g11")

_ExcelWriteCell($oPrintSheet,$s6,"g12")

_ExcelWriteCell($oPrintSheet,$arResult[15],"B10") ;Immediate Action

If @Compiled Then

$oPrintSheet.ActiveSheet.PrintOut(Default, Default, 1, False, $oPrintSheet.ActivePrinter, FALSE, FALSE, "")

EndIf

_ExcelBookClose($oPrintSheet,0)

$nTemp=WinWaitActive("Microsoft Excel","",5)

If NOT $nTemp Then

_CenteredMsg("Print Failed", "The QA Hold Tag failed to print.", "&Okay")

Else

If @Compiled Then

ControlClick("Microsoft Excel","&No",'[CLASS:Button; INSTANCE:2]')

_CenteredMsg("Print", "The QA Hold Tag #"&$arResult[0]&" was printed.", "&Okay")

Else

_CenteredMsg("Print", "Script not compiled.", "&Okay")

EndIf

EndIf

GUISetState(@SW_ENABLE,$hMain)

GUIDelete($hPrntExprt)

EndFunc ;=> _PrintQAHoldTag

Func _WriteReportData($oExcelSheet, $arData)

;header data

Local $nRow, $nColor

_ExcelWriteCell($oExcelSheet, "'Ampac Floeter - Quarantine Report" ,1,1)

_ExcelFontSetProperties($oExcelSheet, 1, 1, 1, 1, True) ; bold

_ExcelFontSetSize($oExcelSheet, 1, 1, 1, 1, 16)

Local $sTemp = 'Date Printed: '&@MON&'/'&@MDAY&'/'&@YEAR

;_ExcelWriteCell($oExcelSheet, $sTemp, 1, 11)

;_ExcelHorizontalAlignSet($oExcelSheet, 1, 11, 1, 11, "right")

;_ExcelVerticalAlignSet($oExcelSheet, 1, 11, 1, 11, "center")

_ExcelWriteCell($oExcelSheet, $sTemp, 1, 14)

_ExcelHorizontalAlignSet($oExcelSheet, 1, 14, 1, 14, "right")

_ExcelVerticalAlignSet($oExcelSheet, 1, 14, 1, 14, "center")

_ExcelWriteCell($oExcelSheet, "'Date Generated",6,1)

_ExcelColWidthSet($oExcelSheet, 1, 9.71)

_ExcelWriteCell($oExcelSheet, "'Customer Order No.",6,2)

_ExcelColWidthSet($oExcelSheet, 2, 9.43)

_ExcelWriteCell($oExcelSheet,"'Customer PO No.",6,3)

_ExcelColWidthSet($oExcelSheet,3,9.43)

_ExcelWriteCell($oExcelSheet, "'QA Hold Number",6,4)

_ExcelWriteCell($oExcelSheet, "'Defect Description",6,5)

_ExcelColWidthSet($oExcelSheet, 5, 32.29)

_ExcelWriteCell($oExcelSheet, "'Quantity",6,6)

$oExcelSheet.ActiveSheet.Range("F6:G6").Merge

_ExcelWriteCell($oExcelSheet,"'Affected Rolls",6,8)

_ExcelColWidthSet($oExcelSheet,8,20)

_ExcelWriteCell($oExcelSheet,"'Affected Boxes",6,9)

_ExcelColWidthSet($oExcelSheet,9,20)

_ExcelWriteCell($oExcelSheet, "'Ampac Lot No.",6,10)

_ExcelWriteCell($oExcelSheet, "'Ampac Skid No.",6,11)

_ExcelWriteCell($oExcelSheet, "'Product Name",6,12)

_ExcelColWidthSet($oExcelSheet, 12, 30)

_ExcelWriteCell($oExcelSheet, "'Notes",6,13)

_ExcelColWidthSet($oExcelSheet, 13, 30)

_ExcelWriteCell($oExcelSheet,"'Status",6,14)

_ExcelColWidthSet($oExcelSheet,14,6)

_ExcelHorizontalAlignSet($oExcelSheet, 6, 1, 6, 14, "center")

_ExcelVerticalAlignSet($oExcelSheet, 6, 1, 6, 14, "center")

_ExcelRowHeightSet($oExcelSheet, 6, 26.25)

_ExcelCellFormat($oExcelSheet, 6, 1, 6, 14, True)

_ExcelCellColorSet($oExcelSheet, 6, 1, 6, 14, 37)

_ExcelWriteCell($oExcelSheet, "'- Rework Internally","B2")

_ExcelWriteCell($oExcelSheet, "'- Rework Externally","B3")

_ExcelWriteCell($oExcelSheet, "'- Release","B4")

_ExcelWriteCell($oExcelSheet, "'- Waste","E2")

_ExcelWriteCell($oExcelSheet, "'- Return of Material","E3")

_ExcelCellColorSet($oExcelSheet, 2, 1, 2, 1, 38)

_ExcelCellColorSet($oExcelSheet, 3, 1, 3, 1, 40)

_ExcelCellColorSet($oExcelSheet, 4, 1, 4, 1, 36)

_ExcelCellColorSet($oExcelSheet, 2, 4, 2, 4, 35)

_ExcelCellColorSet($oExcelSheet, 3, 4, 3, 4, 34)

;write data

For $nCount=1 to Ubound($arData)-1

$nRow=$nCount+6

Local $sDate=StringLeft($arData[$nCount][2],4)

$arData[$nCount][2]=StringReplace($arData[$nCount][2],$sDate,'')

$sDate=StringLeft($arData[$nCount][2],2)&'/'&StringRight($arData[$nCount][2],2)&'/'&$sDate

_ExcelWriteCell($oExcelSheet,$sDate,$nRow,1) ; date

_ExcelWriteCell($oExcelSheet,$arData[$nCount][8],$nRow,2) ; customer order

_ExcelWriteCell($oExcelSheet,$arData[$nCount][18],$nRow,3) ; customer PO number

_ExcelWriteCell($oExcelSheet,"'"&$arData[$nCount][0],$nRow,4) ; QA Hold

_ExcelWriteCell($oExcelSheet,$arData[$nCount][1],$nRow,5) ; Defect Description

_ExcelWriteCell($oExcelSheet,$arData[$nCount][11],$nRow,6) ; Quantity

_ExcelWriteCell($oExcelSheet,$arData[$nCount][12],$nRow,7) ; Quantity Units

_ExcelWriteCell($oExcelSheet,$arData[$nCount][13],$nRow,8) ; Affected Rolls (Disposition)

_ExcelWriteCell($oExcelSheet,$arData[$nCount][19],$nRow,9) ; Affected Boxes

_ExcelWriteCell($oExcelSheet,$arData[$nCount][10],$nRow,10) ; Ampac Lot

_ExcelWriteCell($oExcelSheet,$arData[$nCount][9],$nRow,11) ; Ampac Skid

_ExcelWriteCell($oExcelSheet,$arData[$nCount][7],$nRow,12) ; Product Name

_ExcelWriteCell($oExcelSheet,$arData[$nCount][17],$nRow,13) ; Notes

_ExcelWriteCell($oExcelSheet,$arData[$nCount][14],$nRow,14) ; Status

;add color based on disposition

If $arData[$nCount][16] <> "None" Then

Switch $arData[$nCount][16]

Case "Rework Internally"

$nColor=38 ;rose

Case "Rework Externally"

$nColor=40 ;tan

Case "Release"

$nColor=36 ;light yellow

Case "Waste"

$nColor=35 ;light green

Case "Return of Material"

$nColor=34 ;light turquoise

EndSwitch

_ExcelCellColorSet($oExcelSheet, $nRow, 1, $nRow, 11, $nColor)

EndIf

Next

;draw borders, align cells

_ExcelHorizontalAlignSet($oExcelSheet, 7, 1, $nRow, 4, "center")

_ExcelHorizontalAlignSet($oExcelSheet, 7, 6, $nRow, 6, "right")

_ExcelHorizontalAlignSet($oExcelSheet, 7, 10, $nRow, 11, "center")

_ExcelCreateBorders($oExcelSheet,$xlThin,7,1,$nRow,5,1,1,1,1,1,1)

_ExcelCreateBorders($oExcelSheet,$xlThin,7,8,$nRow,14,1,1,1,1,1,1)

_ExcelCreateBorders($oExcelSheet,$xlThin,7,6,$nRow,7,1,1,1,1,0,1)

;header borders

_ExcelCreateBorders($oExcelSheet, $xlThin, 2, 1, 4, 1, 1, 1, 1, 1,0,1) ;"A2:A4"

_ExcelCreateBorders($oExcelSheet, $xlThin, 2, 4, 3, 4, 1, 1, 1, 1,0,1) ;"D2:D3"

_ExcelCreateBorders($oExcelSheet, $xlThin, 6, 1, 6, 14, 1, 1, 1, 1, 1, 1) ;"A6:J6"

_ExcelCreateDoubleBorders($oExcelSheet, 6, 1, 6, 14, 0, 0, 1, 0) ;"A6:J6"

;change Affected Rolls, Affect Boxes, and Notes columns to wordwrap

With $oExcelSheet.Range("H:H")

.WrapText = True

EndWith

With $oExcelSheet.Range("I:I")

.WrapText = True

EndWith

With $oExcelSheet.Range("M:M")

.WrapText = True

EndWith

With $oExcelSheet.Range("L:L")

.WrapText = True

EndWith

_ExcelVerticalAlignSet($oExcelSheet,7,1,$nRow,14,"center")

;change margins, orientation and size for priting

With $oExcelSheet.ActiveSheet.PageSetup

.LeftMargin = 24

.RightMargin = 24

.TopMargin = 36

.BottomMargin = 36

.Orientation = 2 ;xlLandscape

.Zoom = 61

EndWith

$oExcelSheet.Activewindow.Zoom=80

#cs

_ExcelWriteCell($oExcelSheet, "'QA Hold Number",6,3)

_ExcelWriteCell($oExcelSheet, "'Defect Description",6,4)

_ExcelColWidthSet($oExcelSheet, 4, 32.29)

_ExcelWriteCell($oExcelSheet, "'Quantity",6,5)

;_ExcelCellMerge($oExcelSheet, True, 3, 5, 3, 6) ; not working?

;_ExcelCellMerge($oExcelSheet,True,"E3:F3") ; not working?

$oExcelSheet.ActiveSheet.Range("E6:F6").Merge

_ExcelWriteCell($oExcelSheet, "'Ampac Lot No.",6,7)

_ExcelWriteCell($oExcelSheet, "'Ampac Skid No.",6,8)

_ExcelWriteCell($oExcelSheet, "'Product Name",6,9)

_ExcelColWidthSet($oExcelSheet, 9, 39.86)

_ExcelWriteCell($oExcelSheet, "'Notes",6,10)

_ExcelColWidthSet($oExcelSheet, 10, 41)

_ExcelWriteCell($oExcelSheet,"'Status",6,11)

_ExcelColWidthSet($oExcelSheet,11,6)

_ExcelHorizontalAlignSet($oExcelSheet, 6, 1, 6, 11, "center")

_ExcelVerticalAlignSet($oExcelSheet, 6, 1, 6, 11, "center")

_ExcelRowHeightSet($oExcelSheet, 6, 26.25)

_ExcelCellFormat($oExcelSheet, 6, 1, 6, 11, True)

_ExcelCellColorSet($oExcelSheet, 6, 1, 6, 11, 37)

_ExcelWriteCell($oExcelSheet, "'- Rework Internally","B2")

_ExcelWriteCell($oExcelSheet, "'- Rework Externally","B3")

_ExcelWriteCell($oExcelSheet, "'- Release","B4")

_ExcelWriteCell($oExcelSheet, "'- Waste","F2")

_ExcelWriteCell($oExcelSheet, "'- Return of Material","F3")

_ExcelCellColorSet($oExcelSheet, 2, 1, 2, 1, 38)

_ExcelCellColorSet($oExcelSheet, 3, 1, 3, 1, 40)

_ExcelCellColorSet($oExcelSheet, 4, 1, 4, 1, 36)

_ExcelCellColorSet($oExcelSheet, 2, 5, 2, 5, 35)

_ExcelCellColorSet($oExcelSheet, 3, 5, 3, 5, 34)

;write data

For $nCount=1 to Ubound($arData)-1

$nRow=$nCount+6

Local $sDate=StringLeft($arData[$nCount][2],4)

$arData[$nCount][2]=StringReplace($arData[$nCount][2],$sDate,'')

$sDate=StringLeft($arData[$nCount][2],2)&'/'&StringRight($arData[$nCount][2],2)&'/'&$sDate

_ExcelWriteCell($oExcelSheet,$sDate,$nRow,1) ; date

_ExcelWriteCell($oExcelSheet,$arData[$nCount][8],$nRow,2) ; customer order

_ExcelWriteCell($oExcelSheet,"'"&$arData[$nCount][0],$nRow,3) ; QA Hold

_ExcelWriteCell($oExcelSheet,$arData[$nCount][1],$nRow,4) ; Defect Description

_ExcelWriteCell($oExcelSheet,$arData[$nCount][11],$nRow,5) ; Quantity

_ExcelWriteCell($oExcelSheet,$arData[$nCount][12],$nRow,6) ; Quantity Units

_ExcelWriteCell($oExcelSheet,$arData[$nCount][10],$nRow,7) ; Ampac Lot

_ExcelWriteCell($oExcelSheet,$arData[$nCount][9],$nRow,8) ; Ampac Skid

_ExcelWriteCell($oExcelSheet,$arData[$nCount][7],$nRow,9) ; Product Name

_ExcelWriteCell($oExcelSheet,$arData[$nCount][17],$nRow,10) ; Notes

_ExcelWriteCell($oExcelSheet,$arData[$nCount][14],$nRow,11) ; Status

;add color based on disposition

If $arData[$nCount][16] <> "None" Then

Switch $arData[$nCount][16]

Case "Rework Internally"

$nColor=38 ;rose

Case "Rework Externally"

$nColor=40 ;tan

Case "Release"

$nColor=36 ;light yellow

Case "Waste"

$nColor=35 ;light green

Case "Return of Material"

$nColor=34 ;light turquoise

EndSwitch

_ExcelCellColorSet($oExcelSheet, $nRow, 1, $nRow, 11, $nColor)

EndIf

Next

;draw borders, align cells

_ExcelHorizontalAlignSet($oExcelSheet, 7, 1, $nRow, 3, "center")

_ExcelHorizontalAlignSet($oExcelSheet, 7, 5, $nRow, 5, "right")

_ExcelHorizontalAlignSet($oExcelSheet, 7, 7, $nRow, 8, "center")

_ExcelCreateBorders($oExcelSheet,$xlThin,7,1,$nRow,4,1,1,1,1,1,1)

_ExcelCreateBorders($oExcelSheet,$xlThin,7,7,$nRow,11,1,1,1,1,1,1)

_ExcelCreateBorders($oExcelSheet,$xlThin,7,5,$nRow,6,1,1,1,1,0,1)

;header borders

_ExcelCreateBorders($oExcelSheet, $xlThin, 2, 1, 4, 1, 1, 1, 1, 1,0,1) ;"A2:A4"

_ExcelCreateBorders($oExcelSheet, $xlThin, 2, 5, 3, 5, 1, 1, 1, 1,0,1) ;"E2:E3"

_ExcelCreateBorders($oExcelSheet, $xlThin, 6, 1, 6, 11, 1, 1, 1, 1, 1, 1) ;"A6:J6"

_ExcelCreateDoubleBorders($oExcelSheet, 6, 1, 6, 11, 0, 0, 1, 0) ;"A6:J6"

;change margins, orientation and size for priting

$oExcelSheet.Activewindow.Zoom=85

With $oExcelSheet.ActiveSheet.PageSetup

.LeftMargin = 24

.RightMargin = 24

.TopMargin = 36

.BottomMargin = 36

.Orientation = 2 ;xlLandscape

.Zoom = 71

EndWith

#ce

EndFunc ;=>WriteReportData

Func _EditSelected()

Local $arText, $sDate, $arSelected, $sValues

Dim $arEditControls[21]

$bDoubleClicked=False

Local $nCount=1

$arSelected=_GetQAHoldSelected(_GUICtrlListView_GetSelectedIndices($hListView, True))

Local $sFDetNum=$arSelected[$nCount]

_SQLite_QuerySingleRow($hFile,"SELECT * FROM Data WHERE QA_Hold_Number = '"&$sFDetNum&"';",$arResult)<p> ;Label Text

$arText=0

$arText=IniReadSection($MY_INI,"NewRecord")

If NOT IsArray($arText) Then

MsgBox(0,"INI Corrupt","The INI file is corrupt."

Share this post


Link to post
Share on other sites
ashah
this is the other .au3 file...

Share this post


Link to post
Share on other sites
water

Looks strange. There must be some code missing because there is an "EndFunc ;=> _AddNewRecord" statement without preceding "Func _AddNewRecord", a "WEnd" statement without preceding "While", a "EndSwitch" statement without preceding "Switch" and GUI statements (GUISetState, GUIDelete) without preceding GUI definition.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ashah

I dont think it pasted everything I copied. Maybe due to a limit of number of characters we can post here. Is there anyway I email you the file? Would that make it easier?

Share this post


Link to post
Share on other sites
water

You now have a post count > 5 so i think you can attach files.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ashah

I dont see an attachement option.

Share this post


Link to post
Share on other sites
ashah

Any suggestions?

Share this post


Link to post
Share on other sites
water

I had a quick look at the code and I think it is easier to talk you through debugging because I'm missing a lot of things to make the script run here (INI file, SQLite databaset etc.).

What do you think?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
BrewManNH

First thing you'll need is the ExcelCOM_UDF.au3 file because it has a lot of functions that the included Excel.au3 file doesn't have. Then you're going to need to search for and comment out the line that reads _ExcelCreateDoubleBorders($oExcelSheet, 6, 1, 6, 14, 0, 0, 1, 0) ;"A6:J6" because that function doesn't exist even in the file I linked to. It doesn't seem to do anything other than put borders on some cells, cosmetic issue only. Other than that, I also can't help much because I don't have any of the support files (database, ini file) that is needed to run this script.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
water

What I see from the code is that a right click sets variable $bDoubleClicked to true. This then calls function _EditSelected.

Could you please put this line at the beginning of function _EditSelected so we can see if the function is called when you do right click?

MsgBox(0, "", "_EditSelected called!")

First you have to modify the script as BrewmanNH described above!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×