niassa Posted December 5, 2006 Share Posted December 5, 2006 Hi everyone - I'm new to posting here (though I've read quite a bit) and I'm pretty new to all of this coding stuff, so please bear with me.I have a GUI script that I've done for work that installs a "help" file and an "about" file into a directory that it creates. This works beautifully. When I run the script on my own computer, everything works beautifully - all of the GUI stuff lines up correctly, etc. When I run it on anyone else's computer, however, the GUI is completely garbled. When I comment out the FileInstall lines - it works on anyone's computer. I'm completely baffled and I just can't figure out what in the world I'm doing wrong.(Yes, I know the GUI is very basic... eventually there will be a picture at the top and such, but for right now, I'm just trying to get the basic usability of it working on other people's computers.)Thank you so much in advance for any help you can offer!expandcollapse popup#include <GUIConstants.au3> #include <misc.au3> #include <DSNSetup.au3> $TempDir = "C:\Documents and Settings\" & @UserName & "\RSPActs\" DirCreate($TempDir) FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA Help.txt",$TempDir & "RSPA Help.txt") FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA About.txt",$TempDir & "RSPA About.txt") $dll = DllOpen("user32.dll") Opt("TrayMenuMode",1) Opt("RunErrorsFatal",0) Opt("GUICloseOnESC", 0) Opt("TrayOnEventMode",1) ;~ Oracle Constants Const $adOpenStatic = 3 Const $adLockOptimistic = 3 Const $adUseClient = 3 $objConnection = ObjCreate("ADODB.Connection") $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $objRecordset = ObjCreate("ADODB.Recordset") Dim $RSP ;~ **************************************************************** ~; ;~ ******************* GUI CREATION BEGINS HERE ******************* ~; ;~ **************************************************************** ~; $Form1 = GUICreate("RSP Activations", 435, 501, 193, 115) ;~ To and From Date Fields $Group1 = GUICtrlCreateGroup(" From Date ", 48, 104, 153, 81) $Label1 = GUICtrlCreateLabel("(DD-MMM-YYYY)", 80, 128, 87, 17) $FromDate = GUICtrlCreateInput("", 64, 152, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup(" To Date ", 232, 104, 153, 81) $Label2 = GUICtrlCreateLabel("(DD-MMM-YYYY)", 264, 128, 87, 17) $ToDate = GUICtrlCreateInput("", 248, 152, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) ;~ AP Number Field $Label3 = GUICtrlCreateLabel("RSP AP Number:", 176, 208, 86, 17) $APNumber = GUICtrlCreateInput("", 144, 232, 145, 21) ;~ Login Information $Group3 = GUICtrlCreateGroup(" Login ", 48, 272, 337, 89) $Label4 = GUICtrlCreateLabel("Login:", 72, 296, 33, 17) $Login = GUICtrlCreateInput("", 72, 320, 113, 21) $Label5 = GUICtrlCreateLabel("Password:", 248, 296, 53, 17) $Pword = GUICtrlCreateInput("", 248, 320, 113, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL)) GUICtrlCreateGroup("", -99, -99, 1, 1) ;~ Header Picture $Pic1 = GUICtrlCreatePic("", 48, 8, 337, 81, BitOR($SS_NOTIFY,$WS_GROUP)) ;~ Main Menu $MenuFile = GUICtrlCreateMenu("&File") $MenuExit = GUICtrlCreateMenuItem("E&xit ALT+F4", $MenuFile) $MenuEdit = GUICtrlCreateMenu("&Edit") $MenuSelectAll = GUICtrlCreateMenuItem("Select &All Ctrl+A", $MenuEdit) GUICtrlCreateMenuitem("", $MenuEdit) $MenuCopy = GUICtrlCreateMenuItem("&Copy Ctrl+C", $MenuEdit) $MenuCut = GUICtrlCreateMenuItem("Cu&t Ctrl+X", $MenuEdit) $MenuPaste = GUICtrlCreateMenuItem("&Paste Ctrl+V", $MenuEdit) $MenuHelp = GUICtrlCreateMenu("&Help") $MenuAbout = GUICtrlCreateMenuItem("&About", $MenuHelp) $MenuSubHelp = GUICtrlCreateMenuItem("&Help F1", $MenuHelp) ;~ Run/Clear Buttons $RunButton = GUICtrlCreateButton("Run", 48, 392, 145, 49, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 26, 400, 0, "Lucida Calligraphy") $ClearButton = GUICtrlCreateButton("Clear", 236, 390, 145, 49, 0) GUICtrlSetFont(-1, 26, 400, 0, "Lucida Calligraphy") ;~ SysTray Menu TraySetClick("9") $TrayAbout = TrayCreateItem("About") TrayItemSetOnEvent(-1, "AboutProg") $TrayHelp = TrayCreateItem("Help") TrayItemSetOnEvent(-1, "HelpProg") TrayCreateItem("") $TrayClose = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "GoodBye") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() ;~ Select All Function If _IsPressed("11",$dll) and _IsPressed("41",$dll) and WinActive("RSP Activations") Then CtrlA() EndIf If _IsPressed("70",$dll) and WinActive("RSP Activations") Then HelpProg() EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuExit Exit Case $RunButton ;~ Calls CheckDate Function first, then checks ;~ Login/Pword info to make sure those are filled ;~ in, then goes through and pulls the information If CheckDate(GUICtrlRead($ToDate)) Or CheckDate(GUICtrlRead($FromDate)) Then MsgBox(16,"Error","Enter date in Correct Format: DD-MMM-YYYY") GUICtrlSetState($FromDate,$GUI_FOCUS) Else If GUICtrlRead($Login) = "" And GUICtrlRead($Pword) = "" Then MsgBox(16,"Error","Enter Login and Password for PCOM.world") Else ;~ Base SQL Statement $SQLBase = "Select distinct a.RECEIVER_SERIAL_NO, " & _ "c.EXT_SYS_SELLER_REFERENCE, " & _ "a.ACTIVATION_DATE, " & _ "b.SUBSCRIBER_ID, " & _ "b.CSG_ACCT_NO, " & _ "b.FIRST_ACTIVATION_DATE " & _ "From CM_RECEIVER_HISTORY a " & _ "Inner join CM_SUBSCRIBERS b On a.SUBSCRIBER_ID=b.SUBSCRIBER_ID " & _ "Inner join CM_SELLERS c On a.SELLER_ID=c.SELLER_ID " & _ "Where b.FIRST_ACTIVATION_DATE between '" & GUICtrlRead($FromDate) & "' and '" & GUICtrlRead($ToDate) & "' " & _ "And a.RECEIVER_POSITION = 1 " & _ "And " RunButton() EndIf EndIf Case $ClearButton GUICtrlSetData($FromDate,"") GUICtrlSetData($ToDate,"") GUICtrlSetData($APNumber,"") Case $MenuSelectAll CtrlA() Case $MenuCopy Send("^c") Case $MenuCut Send("^x") Case $MenuPaste Send("^v") Case $MenuSubHelp HelpProg() Case $MenuAbout AboutProg() EndSwitch WEnd Func RunButton() $objConnection.Open ("DSN=my.world;", GUICtrlRead($Login), GUICtrlRead($Pword)) $RSP=GUICtrlRead($APNumber) $SQLWhere = "c.EXT_SYS_SELLER_REFERENCE = " & $RSP $SQLRun = $SQLBase & $SQLWhere If @error <> 1 Then $objExcel = ObjCreate("Excel.Application") $objWB = $objExcel.Workbooks.Add $objSheet = $objExcel.Sheets("Sheet1") $objSheet.Activate $objExcel.Visible = 1 $objRecordset.CursorLocation = $adUseClient $objRecordset.Open ($SQLRun, $objConnection, $adOpenStatic, $adLockOptimistic) $varTest = 2 $objExcel.Cells(1,1) = "RECEIVER_SERIAL_NO" $objExcel.Cells(1,2) = "CSG_ACCT_NO" $objExcel.Cells(1,3) = "EXT_SYS_SELLER_REFERENCE" $objExcel.Cells(1,4) = "ACTIVATION_DATE" $objExcel.Cells(1,5) = "FIRST_ACTIVATION_DATE" $objExcel.Rows("1:1").Select $objExcel.Selection.Interior.ColorIndex = 15 $objExcel.Columns("B:B").Select $objExcel.Selection.NumberFormat = "@" $objExcel.Columns("D:D").Select $objExcel.Selection.NumberFormat = "m/d/yyyy" $objExcel.Columns("E:E").Select $objExcel.Selection.NumberFormat = "m/d/yyyy" $objExcel.Cells(1,1).Select While Not $objRecordset.EOF $objExcel.Cells($varTest,1) = $objRecordset("RECEIVER_SERIAL_NO").value $objExcel.Cells($varTest,2) = $objRecordset("CSG_ACCT_NO").value $objExcel.Cells($varTest,3) = $objRecordset("EXT_SYS_SELLER_REFERENCE").value $objExcel.Cells($varTest,4) = $objRecordset("ACTIVATION_DATE") $objExcel.Cells($varTest,5) = $objRecordset("FIRST_ACTIVATION_DATE") $varTest = $varTest + 1 $objRecordset.MoveNext() WEnd $objExcel.Columns("A:E").EntireColumn.AutoFit EndIf $objConnection.Close EndFunc Func CheckDate($Date) $Split = StringSplit($Date,"-") If $Split[0] = 3 Then Switch StringUpper($Split[2]) Case "JAN" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "FEB" If $Split[1] >= 1 And $Split[1] <= 29 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "MAR" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "APR" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "MAY" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "JUN" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "JUL" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "AUG" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "SEP" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "OCT" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "NOV" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "DEC" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf EndSwitch ElseIf $Date = "" Then Return 1 Else Return 1 EndIf EndFunc Func CtrlA() Send("{END}+{HOME}") EndFunc Func HelpProg() $line = "" $Fileopen = FileOpen ($TempDir & "RSPA Help.txt",0) While 1 $line = $line & FileReadLine($Fileopen) & @CRLF If @error = -1 Then ExitLoop Wend MsgBox(262176,"RSP Activations Help",$line) FileClose ("RSPA Help.txt") EndFunc Func AboutProg() $line = "" $Fileopen = FileOpen ($TempDir & "RSPA About.txt",0) While 1 $line = $line & FileReadLine($Fileopen) & @CRLF If @error = -1 Then ExitLoop Wend MsgBox(262208,"About RSP Activations",$line) FileClose ("RSPA About.txt") EndFunc Func GoodBye() Exit EndFuncThis is what it is supposed to look like (and how it looks when I run it on my computer):This is what it looks like on other computers (when it's garbled):Again, thanks so much for any help you can offer! Link to comment Share on other sites More sharing options...
HardCopy Posted December 6, 2006 Share Posted December 6, 2006 (edited) Just for debug purposes, what happens when you disable/comment out ALL the GUICtrlCreateGroup("", -99, -99, 1, 1) parts of the gui . Do things improve? FYI , your GUI appears fine on my system, WinXP SP2 Edited December 6, 2006 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
niassa Posted December 6, 2006 Author Share Posted December 6, 2006 Just for debug purposes, what happens when you disable/comment out ALL theGUICtrlCreateGroup("", -99, -99, 1, 1) parts of the gui .Do things improve?FYI , your GUI appears fine on my system, WinXP SP2No, unfortunately disabling those lines doesn't do anything. I guess that just closes the group.I'm glad the GUI appears fine on your system.... but, unfortunately, you don't have the help and about files installed for them to actually install them on your system, does that make sense? I suppose I could upload the compiled exe and see what happens... Link to comment Share on other sites More sharing options...
HardCopy Posted December 6, 2006 Share Posted December 6, 2006 No, unfortunately disabling those lines doesn't do anything. I guess that just closes the group.I'm glad the GUI appears fine on your system.... but, unfortunately, you don't have the help and about files installed for them to actually install them on your system, does that make sense? I suppose I could upload the compiled exe and see what happens...hmm....u could just zip up those additional files and add them to your initial post, and i will grab from thereHardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
HardCopy Posted December 6, 2006 Share Posted December 6, 2006 (edited) Ok , i just used some dummy text to recreate your files, and BINGO experience the same problem you mention Odd very Odd, it seems if the files already exist then you get the corrupted display. If you delete the files then let the program virgin fileinstall them, it seems to be fine. (Using the 1=Overwrite Flag didnt make any difference). As a workaround, delete the files from the USERS PC before your program reinstalls them like this. FileDelete($TempDir & "RSPA Help.txt") FileDelete($TempDir & "RSPA About.txt") FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA Help.txt",$TempDir & "RSPA Help.txt") FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA About.txt",$TempDir & "RSPA About.txt") Unless someone else comes up with why this is happening, i would report it as a potential bug. HardCopy Edited December 6, 2006 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
Danny35d Posted December 6, 2006 Share Posted December 6, 2006 I don't know the reason why?, but this work.Delete the following lines from the beginning of the script and add them back ritght after GUISetState(@SW_SHOW)DirCreate($TempDir) FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA Help.txt",$TempDir & "RSPA Help.txt") FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA About.txt",$TempDir & "RSPA About.txt") AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Lord Maim Posted December 6, 2006 Share Posted December 6, 2006 I don't know the reason why?, but this work. Delete the following lines from the beginning of the script and add them back ritght after GUISetState(@SW_SHOW) DirCreate($TempDir) FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA Help.txt",$TempDir & "RSPA Help.txt") FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA About.txt",$TempDir & "RSPA About.txt") I have had the exact same experience with the FileInstall command. I used to have the script install a file first, then call my main GUI as a function. It would display properly until I put in the fileinstall command, and commenting it out made the GUI display properly again. I had to put in the FileInstall command after the GUI was created in order for all the buttons to be in the proper place. (In the case where your main GUI is created as a function, you will have do to as I did and put it in at the bottom of the function.) What's odd, is that any subsequently created GUIs display properly. Its only the initial one that has the issue. o_O Link to comment Share on other sites More sharing options...
ReverendJ1 Posted December 7, 2006 Share Posted December 7, 2006 I had a problem with that too. My GUI would randomly be displayed all screwy. It had a background composed of 10 pictures, about 70% of the time everything would be displayed right, but sometimes they would be all randomly spaced. I couldn't figure it out, because there were no variables deciding where they go. I had about 150 fileinstalls in it, i will try taking them out and see if the problem still occurs. Link to comment Share on other sites More sharing options...
The Kandie Man Posted December 7, 2006 Share Posted December 7, 2006 (edited) Have had this problem as well and i know exactly how to fix it. I simply placed some GUISetState() functions in the middle of my GUIFunctions. So basically, i would make the GUI visible without all the controls finished and continue adding controls. Sometimes when you do too many controls at once and then call GUISetState(), it gets messed up. A user can't even notice that the controls were created in sections since it takes about 10ms to create all the controls even with the GUISetState interruptions. That is roughly 1/100th of a second and therefore nobody can even notice it. Just try this and see if it works for you: expandcollapse popup#include <GUIConstants.au3> #include <misc.au3> #include <DSNSetup.au3> $TempDir = "C:\Documents and Settings\" & @UserName & "\RSPActs\" DirCreate($TempDir) FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA Help.txt",$TempDir & "RSPA Help.txt") FileInstall("C:\Documents and Settings\my.name\Desktop\RSPA About.txt",$TempDir & "RSPA About.txt") $dll = DllOpen("user32.dll") Opt("TrayMenuMode",1) Opt("RunErrorsFatal",0) Opt("GUICloseOnESC", 0) Opt("TrayOnEventMode",1) ;~ Oracle Constants Const $adOpenStatic = 3 Const $adLockOptimistic = 3 Const $adUseClient = 3 $objConnection = ObjCreate("ADODB.Connection") $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $objRecordset = ObjCreate("ADODB.Recordset") Dim $RSP ;~ **************************************************************** ~; ;~ ******************* GUI CREATION BEGINS HERE ******************* ~; ;~ **************************************************************** ~; $Form1 = GUICreate("RSP Activations", 435, 501, 193, 115) ;~ To and From Date Fields $Group1 = GUICtrlCreateGroup(" From Date ", 48, 104, 153, 81) $Label1 = GUICtrlCreateLabel("(DD-MMM-YYYY)", 80, 128, 87, 17) $FromDate = GUICtrlCreateInput("", 64, 152, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup(" To Date ", 232, 104, 153, 81) $Label2 = GUICtrlCreateLabel("(DD-MMM-YYYY)", 264, 128, 87, 17) $ToDate = GUICtrlCreateInput("", 248, 152, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) ;~ AP Number Field $Label3 = GUICtrlCreateLabel("RSP AP Number:", 176, 208, 86, 17) $APNumber = GUICtrlCreateInput("", 144, 232, 145, 21) ;~ Login Information $Group3 = GUICtrlCreateGroup(" Login ", 48, 272, 337, 89) $Label4 = GUICtrlCreateLabel("Login:", 72, 296, 33, 17) $Login = GUICtrlCreateInput("", 72, 320, 113, 21) $Label5 = GUICtrlCreateLabel("Password:", 248, 296, 53, 17) $Pword = GUICtrlCreateInput("", 248, 320, 113, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL)) GUICtrlCreateGroup("", -99, -99, 1, 1) ;~ Header Picture $Pic1 = GUICtrlCreatePic("", 48, 8, 337, 81, BitOR($SS_NOTIFY,$WS_GROUP)) ;~ Main Menu $MenuFile = GUICtrlCreateMenu("&File") $MenuExit = GUICtrlCreateMenuItem("E&xit ALT+F4", $MenuFile) $MenuEdit = GUICtrlCreateMenu("&Edit") GUISetState(@SW_SHOW) $MenuSelectAll = GUICtrlCreateMenuItem("Select &All Ctrl+A", $MenuEdit) GUICtrlCreateMenuitem("", $MenuEdit) $MenuCopy = GUICtrlCreateMenuItem("&Copy Ctrl+C", $MenuEdit) $MenuCut = GUICtrlCreateMenuItem("Cu&t Ctrl+X", $MenuEdit) $MenuPaste = GUICtrlCreateMenuItem("&Paste Ctrl+V", $MenuEdit) $MenuHelp = GUICtrlCreateMenu("&Help") $MenuAbout = GUICtrlCreateMenuItem("&About", $MenuHelp) $MenuSubHelp = GUICtrlCreateMenuItem("&Help F1", $MenuHelp) GUISetState(@SW_SHOW) ;~ Run/Clear Buttons $RunButton = GUICtrlCreateButton("Run", 48, 392, 145, 49, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 26, 400, 0, "Lucida Calligraphy") $ClearButton = GUICtrlCreateButton("Clear", 236, 390, 145, 49, 0) GUICtrlSetFont(-1, 26, 400, 0, "Lucida Calligraphy") ;~ SysTray Menu TraySetClick("9") $TrayAbout = TrayCreateItem("About") TrayItemSetOnEvent(-1, "AboutProg") $TrayHelp = TrayCreateItem("Help") TrayItemSetOnEvent(-1, "HelpProg") TrayCreateItem("") $TrayClose = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "GoodBye") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() ;~ Select All Function If _IsPressed("11",$dll) and _IsPressed("41",$dll) and WinActive("RSP Activations") Then CtrlA() EndIf If _IsPressed("70",$dll) and WinActive("RSP Activations") Then HelpProg() EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuExit Exit Case $RunButton ;~ Calls CheckDate Function first, then checks ;~ Login/Pword info to make sure those are filled ;~ in, then goes through and pulls the information If CheckDate(GUICtrlRead($ToDate)) Or CheckDate(GUICtrlRead($FromDate)) Then MsgBox(16,"Error","Enter date in Correct Format: DD-MMM-YYYY") GUICtrlSetState($FromDate,$GUI_FOCUS) Else If GUICtrlRead($Login) = "" And GUICtrlRead($Pword) = "" Then MsgBox(16,"Error","Enter Login and Password for PCOM.world") Else ;~ Base SQL Statement $SQLBase = "Select distinct a.RECEIVER_SERIAL_NO, " & _ "c.EXT_SYS_SELLER_REFERENCE, " & _ "a.ACTIVATION_DATE, " & _ "b.SUBSCRIBER_ID, " & _ "b.CSG_ACCT_NO, " & _ "b.FIRST_ACTIVATION_DATE " & _ "From CM_RECEIVER_HISTORY a " & _ "Inner join CM_SUBSCRIBERS b On a.SUBSCRIBER_ID=b.SUBSCRIBER_ID " & _ "Inner join CM_SELLERS c On a.SELLER_ID=c.SELLER_ID " & _ "Where b.FIRST_ACTIVATION_DATE between '" & GUICtrlRead($FromDate) & "' and '" & GUICtrlRead($ToDate) & "' " & _ "And a.RECEIVER_POSITION = 1 " & _ "And " RunButton() EndIf EndIf Case $ClearButton GUICtrlSetData($FromDate,"") GUICtrlSetData($ToDate,"") GUICtrlSetData($APNumber,"") Case $MenuSelectAll CtrlA() Case $MenuCopy Send("^c") Case $MenuCut Send("^x") Case $MenuPaste Send("^v") Case $MenuSubHelp HelpProg() Case $MenuAbout AboutProg() EndSwitch WEnd Func RunButton() $objConnection.Open ("DSN=my.world;", GUICtrlRead($Login), GUICtrlRead($Pword)) $RSP=GUICtrlRead($APNumber) $SQLWhere = "c.EXT_SYS_SELLER_REFERENCE = " & $RSP $SQLRun = $SQLBase & $SQLWhere If @error <> 1 Then $objExcel = ObjCreate("Excel.Application") $objWB = $objExcel.Workbooks.Add $objSheet = $objExcel.Sheets("Sheet1") $objSheet.Activate $objExcel.Visible = 1 $objRecordset.CursorLocation = $adUseClient $objRecordset.Open ($SQLRun, $objConnection, $adOpenStatic, $adLockOptimistic) $varTest = 2 $objExcel.Cells(1,1) = "RECEIVER_SERIAL_NO" $objExcel.Cells(1,2) = "CSG_ACCT_NO" $objExcel.Cells(1,3) = "EXT_SYS_SELLER_REFERENCE" $objExcel.Cells(1,4) = "ACTIVATION_DATE" $objExcel.Cells(1,5) = "FIRST_ACTIVATION_DATE" $objExcel.Rows("1:1").Select $objExcel.Selection.Interior.ColorIndex = 15 $objExcel.Columns("B:B").Select $objExcel.Selection.NumberFormat = "@" $objExcel.Columns("D:D").Select $objExcel.Selection.NumberFormat = "m/d/yyyy" $objExcel.Columns("E:E").Select $objExcel.Selection.NumberFormat = "m/d/yyyy" $objExcel.Cells(1,1).Select While Not $objRecordset.EOF $objExcel.Cells($varTest,1) = $objRecordset("RECEIVER_SERIAL_NO").value $objExcel.Cells($varTest,2) = $objRecordset("CSG_ACCT_NO").value $objExcel.Cells($varTest,3) = $objRecordset("EXT_SYS_SELLER_REFERENCE").value $objExcel.Cells($varTest,4) = $objRecordset("ACTIVATION_DATE") $objExcel.Cells($varTest,5) = $objRecordset("FIRST_ACTIVATION_DATE") $varTest = $varTest + 1 $objRecordset.MoveNext() WEnd $objExcel.Columns("A:E").EntireColumn.AutoFit EndIf $objConnection.Close EndFunc Func CheckDate($Date) $Split = StringSplit($Date,"-") If $Split[0] = 3 Then Switch StringUpper($Split[2]) Case "JAN" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "FEB" If $Split[1] >= 1 And $Split[1] <= 29 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "MAR" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "APR" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "MAY" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "JUN" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "JUL" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "AUG" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "SEP" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "OCT" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "NOV" If $Split[1] >= 1 And $Split[1] <= 30 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf Case "DEC" If $Split[1] >= 1 And $Split[1] <= 31 Then If $Split[3] >= 2000 And $Split[3] <= 3000 Then Return 0 Else Return 1 EndIf Else Return 1 EndIf EndSwitch ElseIf $Date = "" Then Return 1 Else Return 1 EndIf EndFunc Func CtrlA() Send("{END}+{HOME}") EndFunc Func HelpProg() $line = "" $Fileopen = FileOpen ($TempDir & "RSPA Help.txt",0) While 1 $line = $line & FileReadLine($Fileopen) & @CRLF If @error = -1 Then ExitLoop Wend MsgBox(262176,"RSP Activations Help",$line) FileClose ("RSPA Help.txt") EndFunc Func AboutProg() $line = "" $Fileopen = FileOpen ($TempDir & "RSPA About.txt",0) While 1 $line = $line & FileReadLine($Fileopen) & @CRLF If @error = -1 Then ExitLoop Wend MsgBox(262208,"About RSP Activations",$line) FileClose ("RSPA About.txt") EndFunc Func GoodBye() Exit EndFunc Edited December 7, 2006 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Lord Maim Posted December 7, 2006 Share Posted December 7, 2006 Have had this problem as well and i know exactly how to fix it. I simply placed some GUISetState() functions in the middle of my GUIFunctions. So basically, i would make the GUI visible without all the controls finished and continue adding controls. Sometimes when you do too many controls at once and then call GUISetState(), it gets messed up. A user can't even notice that the controls were created in sections since it takes about 10ms to create all the controls even with the GUISetState interruptions. That is roughly 1/100th of a second and therefore nobody can even notice it.Just try this and see if it works for you:Heh. For those of us who's code it isn't, can you point out the relevant changes? I need more coffee before I can sift through unfamiliar code. Link to comment Share on other sites More sharing options...
niassa Posted December 7, 2006 Author Share Posted December 7, 2006 Thanks so much for all of your responses. I moved the FileInstall commands to after the GUI creation and now it works beautifully. Now to figure out how to report a potential bug... Link to comment Share on other sites More sharing options...
Lord Maim Posted December 7, 2006 Share Posted December 7, 2006 Thanks so much for all of your responses. I moved the FileInstall commands to after the GUI creation and now it works beautifully. Now to figure out how to report a potential bug... Actually, if it is important for the FileInstall to come before the GUI creation for (as in my case) customization reasons, I've found that a good workaround is to place a Sleep command just before your GUISetState(@SW_SHOW). I don't know why giving the script some extra time to work would affect button position, but for whatever reason, it works. Link to comment Share on other sites More sharing options...
niassa Posted December 7, 2006 Author Share Posted December 7, 2006 Interesting... I may try that, as well, just to see if the various "work-arounds" work in my scenario. Again, thanks so much! Link to comment Share on other sites More sharing options...
The Kandie Man Posted December 8, 2006 Share Posted December 8, 2006 Heh. For those of us who's code it isn't, can you point out the relevant changes? I need more coffee before I can sift through unfamiliar code. Yes, if you look at the functions where the buttons, labels, menus, etc. are being created, you will notice that i randomly placed GUISetState(@SW_Show) between every so many guictrlcreate functions. This for some reason fixed many of the problems that i had when my GUI got scrambled. It just happens that it doesn't like to create all the controls and the GUI at the exact same time. Who knows, you could report it as a bug, the only thing is that it is nearly impossible to replicate multiple times, so pinpointing the bug would be a nightmare.I hope that helps. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Lord Maim Posted December 8, 2006 Share Posted December 8, 2006 Who knows, you could report it as a bug, the only thing is that it is nearly impossible to replicate multiple times, so pinpointing the bug would be a nightmare.Actually, when the code occurs that causes the GUI to be scrambled in this way, it happens 100% of the time. I'd probably be able to live with it if it were just a sporadic event. I'll try the extra SW_Show commands though, and experiment with it instead of the delays. Link to comment Share on other sites More sharing options...
niassa Posted December 11, 2006 Author Share Posted December 11, 2006 the only thing is that it is nearly impossible to replicate multiple times, so pinpointing the bug would be a nightmare.Actually, I can replicate this 100% of the time in my two GUI scripts. I'll probably report it... just so that it's looked into. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now