Jump to content

frodo

Active Members
  • Posts

    37
  • Joined

  • Last visited

frodo's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks for that, it does work, but sheesh, you would hope there was an easier way wouldnt you lol. Thanks again p.s. This came about due to using a custom pie control on a tab, the custom control doesnt match its background to the tab control when using the windows xp theme, so thats the reason i was altering the background. While tearing my hair out ive been using the following workaround at the top of my script to turn the windows xp theme off...back to classic :0 DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
  2. Okay, take something this simple: #include <GuiConstants.au3> $hGUI = GUICreate("", 300, 200) $hTab = GUICtrlCreateTab(10, 10, 280, 180) $TabItem1 = GUICtrlCreateTabItem("TabItem 1") GUICtrlCreateGraphic(20, 80, 14,14, $SS_SUNKEN) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState(-1, $GUI_ONTOP) GUICtrlSetBkColor(-1, 0xff04ff) $TabItem2 = GUICtrlCreateTabItem("TabItem 2") GUICtrlCreateTabItem("") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Then try the commonly used method of colouring the tabs, which is turning the background into a label, and the GUICtrlCreateGraphic part fails.....
  3. Hmm, its nice until you try and use something simple like GUICtrlCreateGraphic on a coloured tab...fails, manily because the tab background is a label now... Surely theres got to be a way to colour the tab without rendering other controls useless? Anyone?
  4. Luckily im not that delicate, but thanks for the post
  5. Okay, So ive seen a few references to RMChart on here, which dont work, the read from file method (until now) was no good for dynamic data- who would want to have to write changes in data to file and then read them back to display the graph?, and the COM object method just crashes AutoIT, so i thought id post the workaround i came up with last night. Let me set the scene: Ive been working on my own clone (an almost exact gui clone) of Ghost using Imagex for a long while and hadnt found a good charting control that was usable in AutoIT, id even tried RMChart once before via DllCall and given up as trying to submit the data to it via DllCall failed and crashed the GUI. So i made a pie chart control using the inbuilt GUICtrlSetGraphic/$GUI_GR_PIE gear, and i was fairly happy. I put the project on hold, but then dragged it out last night after months of not looking at it. I looked at it for the first time in ages and thought "i really hate the pie graph, the Ghost 3d one was sweet. Dug up the RMChart.dll and thought id have another crack! So first off i tried the DllCall method to submit the data and as it had failed before i wasnt surprised when it failed again. Decided to approach it from a different angle...wondered if the RMC_CREATECHARTFROMFILE method in the dll was literal, would it only render a graph from file? I decided to try grabbing the data string that RMCDesigner allows you to export (usually its in the output file) and assigning it to a variable and using a DllCall using RMC_CREATECHARTFROMFILE referencing the variable....yay worked! I then started to decipher the parts of the string that related to the data, for a pie graph, theyre at the end of the data string (using a 70/30 pie chart - 2 slices): 0000365|0000465|000051|000061|00008-2|00009412|00011Tahoma|100011|1000910|100181|100481|10051-2|10052-1|10053-657956|10063-1|100651|110011|1100251|1100454|110081|110161|110211|110221|110232|11051-65281*-16776961|11053 70*30 Since i created this chart via RMCDesigner specifically to sit in a certian spot and only operate as a simple pie chart for my needs, i didnt need to decode anything else in the string, although: 0000365|0000465 - the 65's in this are the chart size. Of course making anything else other than a simple pie chart with this method will require a lot of decoding for x/y plotted graphs etc, all you need to do is design it and then decode the parts of the string that control data input. The string changes to options in RMCDesigner, for my work i used transparent everywhere in the designer and pie 3d, gradient..... So having that sorted out, i hit a new snag....being a control called via DllCall, i had no control on its behaviour on Tabs (the chart can only be attached to the gui (form), not the tab control), it showed on all 4 tabs i had, when i wanted it just on one..... Luckily another DllCall and a bit of Case $msg = $tab work and all was well. Heres the demo script, make sure you grab the RMChart.dll from http://www.rmchart.com/rmc/Downloads.htm , i suggest getting the full package (setup.exe) from there, it copies the Dll to system32 and also gives you RMCDesigner as well..... #include <GUIConstants.au3> #Include <GuiTab.au3> ;static values for pie Global $P1 = 70 Global $P2 = 30 ;Open the RMChart dll Global $RMChartDll = DllOpen("rmchart.dll") ;RMChart Object instance 1 Global $RMChartObj = 1 $GUI = GUICreate("My GUI Tab",320,320); will create a dialog box that when displayed is centered $tab=GUICtrlCreateTab (10,10, 300,300) ;Change the tab colour to the same default grey as the normal gui to hide the RMChart surround ;In my example i set the RMChart background to transparent in the RMCDesigner, there wasnt any colour in it that approached the normal tab color _GUICtrlTab_SetBkColor($GUI, $tab, 0xECE9D8) $tab0=GUICtrlCreateTabitem ("tab0") $tab1=GUICtrlCreateTabitem ( "tab1") $tab2=GUICtrlCreateTabitem ("tab2") GUICtrlCreateTabitem (""); end tabitem definition ;Call the func that draws the pie Draw_Pie() ;Show the GUI GUISetState(@SW_SHOW, $GUI) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $tab Select Case GUICtrlread ($tab) = 0 ;Call the func that draws the pie when we go back to tab0 Draw_Pie() Case GUICtrlread ($tab) = 1 ;Destroy the pie when we click on other tabs dllcall($RMChartDll,"long","RMC_DELETECHART","long",$RMChartObj) Case GUICtrlread ($tab) = 2 ;Destroy the pie when we click on other tabs dllcall($RMChartDll,"long","RMC_DELETECHART","long",$RMChartObj) Case GUICtrlread ($tab) = 3 ;Destroy the pie when we click on other tabs dllcall($RMChartDll,"long","RMC_DELETECHART","long",$RMChartObj) EndSelect EndSelect Wend Func Draw_Pie() $RMString = "0000365|0000465|000051|000061|00008-2|00009412|00011Tahoma|100011|1000910|100181|100481|10051-2|10052-1|10053-657956|10063-1|100651|110011|1100251|1100454|110081|110161|110211|110221|110232|11051-65281*-16776961|11053" & $P1 & "*" & $P2 ;Call the createchart method, the 70's in here are where to draw the chart in the GUI.... $RMCreate1 = dllcall($RMChartDll,"long","RMC_CREATECHARTFROMFILE","long",$GUI ,"long",$RMChartObj,"long",70,"long",70,"long",0,"str",$RMString) ;Draw the chart $RMCreate2 = dllcall($RMChartDll,"long","RMC_DRAW","long",$RMChartObj) EndFunc ; Change tab color routine pinched from the forums :) Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor) Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32) Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1) GUICtrlCreateLabel("", $aTabPos[0]+2, $aTabPos[1]+$aTab_Rect[3]+4, $aTabPos[2]-4, $aTabPos[3]-$aTab_Rect[3]-7) GUICtrlSetBkColor(-1, $sBkColor) GUICtrlSetState(-1, $GUI_DISABLE) EndFunc And to see where i applied this, heres a pic....in the demo above the values are static, in my script the pie is drawn according the the drive space - used/free and the chart updates accordingly without delay:) Hopefully this is useful to others, and a starting point
  6. Exactly right. Very eloquently put, i couldnt have put i better myself The very first thing i tried was: IsInt($1) to make sure i was complying with the Hex() function........dont shoot the end user, i was merely following instructions in the help file. The demon is not me, the demon is in the code.
  7. You dear Sir, are a prince amongst men. Thank you very much. I dont know why i didnt try that in amongst the half million things i tried before posting. Just quietly, this whole thing is quite retarded
  8. Again, i know youre trying to help, but im seriously not joking, even cutting and pasting your example equals failure for me: I get: 4294966636 which as previously stated is whats in the registry and 1000% correct And : 80000000 after Hex() Total failure......somewhere deep in the bowels of AutoIT, something is p4uck3d, this is ridiculous.... What im doing in writing a routine that regreads values from the registry and depending on the @extended value, writes the keys with a correct prefix and format for use in BartPE .inf files... And before you ask why im not reg exporting it all, i need to manipulate the data before writing it out Sheesh, even doing the binary 0x3 type stuff (inserting commas every 3 characters and backslashes and @CRLF at every 63rd) was simple compared to my current drama.... For example (chopped a lot out for brevity): $1 = RegReadExt("HKLM\SYSTEM\ControlSet001\Services\IdeBusDr\Security", "Security") IniWrite($IniFile, "Setup.AddReg", $RegTypePrefix & ', "CurrentControlSet\Services\IdeBusDr\Security"' & ", " & $ValueNameFinal & $ValueFinal, "IGNORE") $2 = RegReadExt("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "ActiveTimeBias") IniWrite($IniFile, "Setup.AddReg", $RegTypePrefix & ', "CurrentControlSet\Control\TimeZoneInformation"' & ", " & $ValueNameFinal & $ValueFinal, "IGNORE") Func RegReadExt($MainKey, $ValueName) $ValueReturn = RegRead($MainKey, $ValueName) Select Case @extended = 3 $RegTypePrefix = "0x3" $ProcValue1 = _StringInsert2($ValueReturn, ",", 2); external routine that inserts characters every x chars. This time its the commas between number pairs $ProcValue2 = _StringInsert2($ProcValue1, "\" & @CRLF, 63 );backslash and line breaks at every 63rd character, 63 looks pretty $ValueName = Chr(34) & $ValueName & Chr(34) $ValueFinal = @CRLF & $ProcValue2 & @CRLF Case @extended = 4 $RegTypePrefix = "0x4" $ValueName = $ValueName $ValueFinal = "0x" & Hex($ValueReturn) EndSelect EndFunc Which gives output like: [Setup.AddReg] 0x3, "CurrentControlSet\Services\IdeBusDr\Security", "Security",\ 01,00,14,80,90,00,00,00,9C,00,00,00,14,00,00,00,30,00,00,00,02,\ 00,1C,00,01,00,00,00,02,80,14,00,FF,01,0F,00,01,01,00,00,00,00,\ 00,01,00,00,00,00,02,00,60,00,04,00,00,00,00,00,14,00,FD,01,02,\ 00,01,01,00,00,00,00,00,05,12,00,00,00,00,00,18,00,FF,01,0F,00,\ 01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,00,00,14,00,8D,\ 01,02,00,01,01,00,00,00,00,00,05,0B,00,00,00,00,00,18,00,FD,01,\ 02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,00,\ 00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00 0x4, "CurrentControlSet\Control\TimeZoneInformation", "ActiveTimeBias", 0x80000000
  9. Id love to tell you that worked, but i already tried anything i could in the helpfile at 1:00AM including IsInt() and IsNumber() (both return 1 btw) etc...makes no difference Number() is not the solution. Surely RegRead knows its a DWord value as i can confiirm it with the @extended value.... Why it comes back as Decimal as default is really quite pissing me off Anyways heres the original code in one hit, updated the msgbox headnigs form test 1 etc to make it easier to see which value is being displayed $1 = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "ActiveTimeBias") MsgBox(0,"RegRead - Decimal ", $1) $result = Hex($1) MsgBox(0,"Hex", $result) $result2 = Hex(4294966636) MsgBox(0,"Correct Hex", $result2) A big thank you to the first person who can figure out why this isnt working
  10. Okay, this is really annoying me, and im struggling to figure it out. The problem is with Hex(), i need to get the return from the regread (returns the decimal value) and convert it to hex, why i cant choose to have the DWORD key type in Hex by default, i dont know, but there you are..... For example: $1 = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "ActiveTimeBias") MsgBox(0,"test1", $1) This returns: 4294966636 (Correct) $result = Hex($1) MsgBox(0,"test2", $result) This returns: 8000000 (Incorrect) While specifying: $result2 = Hex(4294966636) MsgBox(0,"test3", $result2) Returns: FFFFFD6C (Correct) What am i missing here?
  11. Dont know if this helps.... I have a tabbed GUI, and on one tab i have a pie chart, before i figured out the the following, the pie chart would show on all tabs. CODE $Main_Pie = GUICtrlCreateGraphic(570, 253, 60, 60) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState(-1, $GUI_ONTOP) The $Main_Pie above merely sets the display area for the pie, in my script the actual pie is drawn into this space in a seperate function with: GUICtrlSetGraphic($Main_Pie,$GUI_GR_PIE, 120,70, 30, 0, 360) So basically try setting the control to GUI_DISABLE and then GUI_ONTOP
  12. Again from that other forum, after my collapse in the early hours today due to hatred of MS, comes this to update things........... Frodo had to collapse early this morning after going through several permutations of this progress control. Frodo found the excitement fo getting something back from stdout intoxicating, but the excitement was short lived as it became obvious that no permutation was going to give him a 100% nice and sane output. The closest i came to text perfection was similar to Jaque's 2nd snippet.: But not finding that 100% to my exacting standards, gee who am i i kidding...umm because it was still visually a little flakey, i didnt get as far as Ixel's contribuation below. I had put my cranky pants on before i hit this stage. Im still really nto a big fan of Ms for having to resort to such things *stomping feet*.
  13. In the interest of sharing, heres a cut&paste form a post i just made in the 911cd forums, where im working on an imagex gui, that looks suspiciously like Ghost v9:) After struggling with the wimgapi and the obvious deficits with wimgapi needing threading and autoit not supportuing this, i decided to regress to the imagex.exe to do the imaging in my project. After seeing this thread the other night, i thought id pop back in and post my results. c&p: This is just the first quick hack, and im posting it because im a little excited..... Variable names and values arent exact and havent been changed to protect the innocent. If you want to test it and you have AutoIT, grab the rtconsole.exe from the archive HERE and put it in the same folder as imagex, or in your path. Obviously change the paths as well:) Be aware that the feedback isnt exactly real time (well i wasnt doing large folders during tetsing just now, so maybe it works better on large images), but short of forking out $299 for the SmartWim or me spending the next year learning to do callbacks around MS's brain fart mentality with wimapi, i reckon this will do for a first go. CODEGlobal $line $srcpath = "c:\program files\java" $targetpath = "f:\win.wim" $desc = "test" $foo = Run(@ScriptDir & "\rtconsole.exe imagex /capture /scroll " & Chr(34) & $srcpath & Chr(34) & " " & Chr(34) & $targetpath & Chr(34) & " " & Chr(34) & $desc & Chr(34),"","",2+4) SplashTextOn("Imagex", $line, 200, 50) While 1 $line = StdoutRead($foo, 5) If @error Then ExitLoop ControlSetText("Imagex", "", "Static1", $line) Wend EDIT: Just tried it on something larger and it kind of peters out at @40% returns part of a string "ng" and then returns at 99%.....sheesh...but its a start........ Changing the StdoutRead($foo, 5) to other values and stringleft'ing it or trimming it is kind of flakey.... Running it with $line = StdoutRead($foo) is even worse..... Maybe its back to square one ....sheesh..i hart Microsoft right now............. Need sleep, ill worry about it tomorrow
  14. Ooops, good point, i was in a rush last night with my own code and solved it there,. Changed in original post! Thanks for the reminder, err kick in the pants
  15. Came cross this thread while trying to find an eays way to add multiple items together. The example above gave me a great start, so im posting the slightly modified code for adding multiple selected items below. CODE #include <GUIConstants.au3> #include <GUIListView.au3> GUICreate('Add Columns', 300, 200) $lv = GUICtrlCreateListView('Date|Amount|Item', 10, 10, 280, 144, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER)) GUICtrlCreateListViewItem('2007/12/25|$50.00|Xmas Gift', $lv) GUICtrlCreateListViewItem('2007/12/24|$35.50|Lunch', $lv) GUICtrlCreateListViewItem('2007/12/23|$60.00|Hookers', $lv) GUICtrlCreateListViewItem('2007/12/23|$35.00|Hooker''s Lunch', $lv) _GUICtrlListViewSetColumnWidth($lv, 0, 70) $btn = GUICtrlCreateButton('Get Total!', 10, 164, 60, 26) $lbl = GUICtrlCreateLabel('Total is: $00.00', 80, 164, -1, -1, $SS_CENTERIMAGE + $SS_CENTER) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $btn GUICtrlSetData($lbl, 'Total is: $' & _addit()) EndSwitch WEnd Func _addit() Dim $total Local $sa = _GUICtrlListViewGetSelectedIndices($lv,1) For $i = 1 To UBound($sa) - 1 $num = StringTrimLeft(_GUICtrlListViewGetItemText($lv, $sa[$i], 1), 1) $total = $total + $num Next Return StringFormat('%.2f', $total) EndFunc
×
×
  • Create New...