Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/20/2015 in all areas

  1. 20-9-2015: Uploaded a new SciTE4AutoIt3.exe. Merged the SciTE 3.6.0 source into our version and several fixes. We now also have set the default encoding to UTF8 W/O Bom when no other File encoding is specified or special ASCII characters are detected in the source. Enjoy, Jos Addition/Changes/Fixes in the current installer: 20-9-2015 *** Merged the SciTE v 3.6.0 by Neil Hodgson with our own version of SciTE. (Jos)     - More fixes to outputpane lexing to ensure FuncTrace generated lines work again.     - Added tf8.auto.check=4 default to SciTEGlobal. properties to check files when opened for their encoding or else use utf8 w/o BOM ad default. *** Updated AutoIt3Wrapper v15.920.938.0 (Jos)     - 15.729.1555.1: Fixed /Watcher and /Jump2FirstError mechanism to kill the script when Ctrl+Break or via the Menu the script should be terminated.     - 15.729.1555.2: Added Win10 to the Manifest and made that the default similar to what aut2exe does.     - 15.729.1555.3: 15.729.1555.4 "Version Diff Source" now properly handling UTF encoded files.     - 15.729.1555.4: Internal mods.     - 15.729.1555.5: Added /RunAfter to copy to Programdir and Versioning without compiling.     - 15.729.1555.6: Changes to the tempfiles generated to allow for concurrent sessions of Autot3Wrapper.     - 15.729.1555.7: cleanup some tempfile remaining behind.     - 15.729.1555.8: Fixed consolewrite in debug mode.     - 15.729.1555.9: killed extra autoit3 pid when restarting the script.     - 15.729.1555.10: Removed Compiled support statements.     - 15.729.1555.11: Added a console message when Script requires Admin and SciTE is running on normal level that no console output will be displayed. *** Updated Au3Stripper v15.920.938.0 (Jos)     - 15.729.1555.2: Fixed issue for Include files with BOM encoding not recognizing #Include-once on the first line.     - 15.729.1555.3: Fixed hardcrash in case de au3stripper didn't exist and /debug was specified.     - 15.729.1555.4: Minor internal changes. *** Updated SciTEConfig v15.920.938.0 (Jos)     - added scheme OLD_LCD.SciTEConfig  (mLipok) *** Updated Au3Stripper v15.729.1555.0 (Jos)     - 15.729.1555.1: Fixed hardcrash in case an Include is used with BOM and #include-once on the first line. *** Updated Tidy v15.920.938.0 (Jos)     - 15.729.1555.1: Fixed hardcrash adding Gobal Const to the variable tables. ==> ScitillaHistory page containing all SciTE-Scintilla updates. ==> Visit the SciTE4AutoIt3 Download page for the latest versions ==> Check the newly formatted the online documentation for an overview of all extra's you get with this installer.
    2 points
  2. Good news. You can be sure I'll keep an eye on this project. Thanks. mLipok
    1 point
  3. The enter key was alredy set to restart, just wasn't written anywhere I think the hotkey problem is fixed now
    1 point
  4. @argumentum Thanks for the link. I think i can manually type missing descriptions from the MSDN page.
    1 point
  5. ...maybe the array can be loaded from an external file holding the descriptions. The descriptions can be added by collaboration of all those wising to participate. The info can be found in MSDN ( https://msdn.microsoft.com/en-us/library/windows/desktop/ff485968(v=vs.85).aspx for List Box Notifications, etc. ) and added to the structure of the descriptions file that you'd create. In my take at Script-o-matic you can see an example of how helpful can be to have the info. right there. It would be of great aid, to have the code generator, supply a guide for the casual coder ( like me ), that don't have a good grasp on these. In any case thanks for sharing this tool @kcvinu .
    1 point
  6. I would advise you to check out the Help file since pretty much all your requests are pretty simple and could probably be found easily. But lets get to some of it. 1: Why would you need to do this through AutoIt? Correct me if I'm wrong but can't you enable screen saver and click the box "On resume, display logon screen" 2: Not someone who has even changed language and stuff on windows so not sure, sorry. 3: This can be accomplished with HotKeySet (In help file) by setting a Hotkey to Win+Tab to anything it over rides default (So if nothing, just make it do a Sleep(100) ) 4: Same as above ^ Just set the Hotkey to Send (In help file) the Winkey+Tab 5: _IEBodyReadHTML (In help file) will work out for you. If you really need some help (I don't know if you have any experience or not) let me/people know and we will help!
    1 point
  7. Jfish

    How to convert files

    Just in case the OP was asking a legit question check the help file for how to compile. @Danyfirex is saying it is not permitted to discuss the reverse here - which you would not need if you have the original script. The original is au3 file is preserved not "converted" it just creates an additional exe. Therefore, if you compile you have both.
    1 point
  8. Well, thanks for all the help! I've gotten a lot further, and this is my progress so far. For pictures to be displayed in the buttons simply press the prnt scrn button while playing a level. Any further suggestion of any sort would be appreciated #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WindowsConstants.au3> #Include <GuiconstantsEx.au3> #Include <GDIPlus.au3> #include <WinAPIGdi.au3> #include <Screencapture.au3> #Include <ButtonConstants.au3> #include <File.au3> #include <GuiConstants.au3> #Include <Crypt.au3> HotKeySet("{ESC}", "Terminate") #Region Gui $PictureDir=@ScriptDir & "\JuegoData\" $WinWidth=500 $WinHeight=400 $hGUI=GUICreate("", $WinWidth, $WinHeight, -1, -1, $WS_POPUPWINDOW) GUISetState() Dim $Button[17] #EndRegion #Region Graphics $GDI_QUALITY=2 _GDIPlus_Startup() $GDI_GRAPHICS=_GDIPlus_GraphicsCreateFromHWND($hGUI) $GDI_BITMAP=_GDIPlus_BitmapCreateFromGraphics($WinWidth, $WinHeight, $GDI_GRAPHICS) $GDI_BACKBUFFER=_GDIPlus_ImageGetGraphicsContext($GDI_BITMAP) _GDIPlus_GraphicsSetSmoothingMode($GDI_BACKBUFFER, $GDI_QUALITY) _GDIPlus_GraphicsClear($GDI_BACKBUFFER) $GDI_BRUSH_BALL=_GDIPlus_BrushCreateSolid() #EndRegion #Region GraphicObjects Dim $Obj[1][14] Dim $Text[1][5] $Text_Num=0 $Obj_Num=0 Dim $Obj_DirectionX[1] Dim $Obj_DirectionY[1] Dim $SolidBrush[20] $SolidBrush[0]=_GDIPlus_BrushCreateSolid() $SolidBrush[1]=_GDIPlus_BrushCreateSolid(0xFF00FF00) $SolidBrush[2]=_GDIPlus_BrushCreateSolid(0xFFFF0000) $SolidBrush[3]=_GDIPlus_BrushCreateSolid(0xFF00FFFF) $SolidBrush[4]=_GDIPlus_BrushCreateSolid(0xFFddad19) $SolidBrush[5]=_GDIPlus_BrushCreateSolid(0xFF004400) $SolidBrush[11]=_GDIPlus_BrushCreateSolid(0xFFFF9900) $SolidBrush[12]=_GDIPlus_BrushCreateSolid(0xFF00FFFF) $SolidBrush[13]=_GDIPlus_BrushCreateSolid(0xFF0000FF) $SolidBrush[14]=_GDIPlus_BrushCreateSolid(0xFF734021) Dim $VanishBrush[1] Dim $EpicBrush[3] $Brush=1 $EpicBrush[0]=_GDIPlus_BrushCreateSolid(0xFFc03430) $EpicBrush[1]=_GDIPlus_BrushCreateSolid(0xFFf8cf46) $EpicBrush[2]=_GDIPlus_BrushCreateSolid(0xFF367341) #EndRegion #Region GameVars Dim $FileLineData[0] $TakeScreenshot=False $GoToMenu=False $WinActive=True Dim $Vanish[1] $BrownStopCount=0 $BrownStop=False $BallDirection=1 $BallWidth=20 $BallHeight=20 $BallSpeed=1 $BallSpeedY=0 $BallPosX_0=0 $BallPosX=$BallPosX_0 $BallPosY_Start=$WinHeight-$BallHeight $BallPosY_0=375 $BallPosY=$BallPosY_0 $SurfaceCount=0 $Jump=False $JumpHeight=350 $JumpSoon=False $JumpSoonTimer=TimerInit() $IsSqueezed=0 $SurfaceMove=0 $Level=1 $BallPosYDiff=0 $LastBallPosY=$BallPosY $ActivePowerup=0 $ExtraJumpActive=0 $TeleTimer=TimerInit() Dim $VanishTimer[1] #EndRegion Menu() #Region Quality $QualityTimer=TimerInit() $QualityCount=0 $QualityFPS=60 $QualitySleep=2000 $USleepTimer=TimerInit() #EndRegion While 1 CheckActive() GetNewBallPos() _GDIPlus_GraphicsClear($GDI_BACKBUFFER, 0xFFFFFFFF) CheckVanish() DrawText() DrawObjects() MoveBall() _GDIPlus_GraphicsDrawImageRect($GDI_GRAPHICS, $GDI_BITMAP, 0, 0, $WinWidth, $WinHeight) If $TakeScreenshot=True Then TakeSnapShot() Gravity() QualityCheck() $ScriptPos=0 If $GoToMenu=True Then GoToMenu() USleep($QualitySleep) $ScriptPos=1 WEnd ;================================================================================= ;============================== OBJECT DESCRIPTION =============================== ;==============================--------------------=============================== ;============ Solid( Type, X, Y, [Width, Height, X2, Y2, Speed) ================== ;==============================--------------------=============================== ;============================== TYPES ============================== ;============================== 0 = Black Solid ============================== ;============================== 1 = Green Goal ============================== ;============================== 2 = Red Fail ============================== ;============================== 3 = Cyan Lock ============================== ;============================== 4 = Gold Sticky ============================== ;============================== 5 = Green Vanish ============================== ;============================== 11 = Extra Jump ============================== ;============================== 12 = Cyan Key ============================== ;============================== 13 = Blue Teleport ============================== ;============================== 14 = Brown Stop ============================== ;================================================================================= Func LevelFromTxt($_Level) $Level=$_Level $FileDir=@ScriptDir & "\JuegoData\Level" & $_Level & ".txt" $FileLines=_FileCountLines($FileDir) $FileOpen=FileOpen($FileDir) For $1=1 To $FileLines $FileData=FileReadLine($FileOpen, $1) StringReplace($FileData, ",", ",") $FileDataLen=@extended If StringLeft($FileData, 5)="Solid" Then $FileMode=1 If StringLeft($FileData, 4)="Text" Then $FileMode=0 $FileData=StringTrimLeft($FileData, 5+$FileMode) ReDim $FileLineData[0] ReDim $FileLineData[9] For $2=0 To $FileDataLen $FileLen=StringInStr($FileData, ",") $FileLineData[$2]=StringLeft($FileData, $FileLen-1) $FileData=StringTrimLeft($FileData, $FileLen) Next $FileLineData[$FileDataLen]=StringTrimRight($FileData, 1) If $FileMode=1 Then If $FileLineData[3]="" Then $FileLineData[3]=25 If $FileLineData[4]="" Then $FileLineData[4]=25 If $FileLineData[5]="" Then $FileLineData[5]=$FileLineData[1] If $FileLineData[6]="" Then $FileLineData[6]=$FileLineData[2] If $FileLineData[7]="" Then $FileLineData[7]=100 If $FileLineData[8]="" Then $FileLineData[8]=$SolidBrush[$FileLineData[0]] Solid($FileLineData[0], $FileLineData[1], $FileLineData[2], $FileLineData[3], $FileLineData[4], $FileLineData[5], $FileLineData[6], $FileLineData[7], $FileLineData[8]) ElseIf $FileMode=0 Then If $FileLineData[3]="" Then $FileLineData[3]=10 If $FileLineData[4]="" Then $FileLineData[4]="Arial" Text($FileLineData[0], $FileLineData[1], $FileLineData[2], $FileLineData[3], $FileLineData[4]) EndIf Next EndFunc Func Level8() $Level=8 Solid(0, 100, -50, 25, 450) Solid(0, 225, -50, 25, 425) Solid(0, 350, -50, 25, 425) Solid(3, 225, 375, 25) Solid(3, 350, 375, 25) Solid(13, 0, 310, 25, 15, 75, 310, 400) Solid(13, 0, 200, 25, 15, 75, 200, 200) Solid(2, 0, 290, 100, 15) Solid(13, 0, 270, 25, 15, 75) Solid(13, 0, 100, 25, 15) Solid(0, 0, 150, 50, 10, 50, 150, 80) Solid(0, 0, 85, 25, 15) Solid(13, 80, 0, 15, 25, 80, 25) Solid(13, 130, 0, 15, 25) Solid(2, 50, 75, 50, 15) Solid(2, 125, 50) Solid(0, 150, 50) Solid(2, 200, 50) Solid(0, 200, 128) Solid(2, 170, 128, 30) Solid(0, 125, 75, 10, 90) Solid(0, 150, 200, 50) Solid(2, 200, 200) Solid(0, 150, 250) Solid(11, 200, 275, 20, 20) Solid(2, 150, 275) Solid(2, 125, 300, 100) Solid(13, 125, 285, 25, 15) Solid(13, 250, 275, 25, 15) Solid(5, 250, 325, 50) Solid(2, 250, 350, 100) Solid(0, 275, 265, 25, 32) Solid(2, 250, 250, 50, 15) Solid(5, 325, 275) Solid(5, 250, 225) Solid(5, 250, 170) Solid(5, 325, 180) Solid(5, 300, 100) Solid(5, 325, 115) Solid(5, 250, 50) Solid(13, 335, 0, 15, 25) Solid(13, 375, 0, 15, 25) Solid(2, 375, 75, 40) Solid(5, 415, 75) Solid(2, 440, 75, 60) Solid(14, 425, 0, 20, 20) Solid(11, 450, 25, 20, 20) Solid(5, 375, 190, 25, 20) Solid(2, 400, 190, 40, 20) Solid(0, 440, 100, 20, 110) Solid(11, 417, 125, 20, 20) Solid(14, 375, 105, 20, 20) Solid(14, 375, 160, 20, 20) Solid(2, 375, 275) Solid(11, 400, 275, 20, 20) Solid(11, 450, 250, 20, 20) Solid(11, 472, 200, 20, 20) Solid(14, 472, 150, 20, 20) Solid(12, 472, 100, 20, 20) Solid(11, 472, 310, 20, 20) Solid(2, 425, 350, 75) Solid(1, 150, 350, 50) EndFunc Func Level7() $Level=7 ;~ $BallPosX_0=0 ;~ $BallPosX=225 ;~ $BallPosY_0=0 ;~ $BallPosY=$BallPosY_0 ;~ $BallDirection=2 Solid(2, 0, 225, 75) Solid(2, 75, 225, 25, 50) Solid(0, 75, 275, 25, 75) Solid(1, 0, 250, 75) Solid(2, 150, 325, 100) Solid(2, 275, 375) Solid(2, 250, 300) Solid(2, 275, 275, 50) Solid(2, 325, 300) Solid(2, 350, 375) Solid(2, 350, 275, 50) Solid(2, 400, 275, 25, 50) Solid(2, 450, 375) Solid(0, 475, 375) Solid(11, 475, 350, 20, 20) Solid(2, 425, 250, 75) Solid(3, 0, 325, 75) Solid(0, 150, 300, 100) Solid(2,100, 225, 125) Solid(0, 300, 250) Solid(0, 400, 250) Solid(2, 400, 125, 25, 75) Solid(0, 475, 200) Solid(0, 425, 150) Solid(0, 375, 125) Solid(11, 325, 125, 20, 20) Solid(2, 250, 75, 25, 75) Solid(2, 200, 150, 25, 75) Solid(0, 150, 200, 50) Solid(11, 50, 200, 20, 20) Solid(11, 0, 125, 20, 20) Solid(11, 50, 75, 20, 20) Solid(11, 100, 75, 20, 20) Solid(11, 225, 75, 20, 20) Solid(11, 300, 50, 20, 20) Solid(11, 450, 50, 20, 20) Solid(11, 450, 0, 20, 20) Solid(12, 475, 0, 20, 20) Solid(11, 400, 0, 20, 20) EndFunc Func Level6() $Level=6 Solid(0, 100, 100, 25, 300) Solid(0, 75, 375) Solid(0, 0, 325) Solid(0, 50, 275) Solid(0, 50, 200) Solid(0, 0, 225) Solid(0, 50, 140) Solid(0, 50, 75, 75) Solid(0, 0, 75) Solid(2, 75, 0, 25, 75) Solid(13, 55, 25, 15, 25) Solid(13, 105, 25, 15, 25) Solid(0, 150, -25, 25, 375) Solid(0, 300, 50, 25, 350) Solid(4, 225, 300, 75, 25, 225, 400, 400) Solid(0, 175, 200, 50, 25, 175, 300, 200) Solid(0, 225, 225, 75) Solid(0, 175, 100, 50, 25, 175, 200, 200) Solid(0, 225, 50, 75, 25, 225, 125, 400) Solid(0, 325, 50, 150) Solid(2, 350, 25, 25, 25, 425, 25, 200) Solid(0, 375, 175, 75) Solid(4, 450, 175, 50) Solid(2, 325, 75, 25, 25, 425) Solid(2, 375, 150, 25, 25, 400) Solid(0, 450, 75, 25, 50) Solid(0, 325, 225, 50, 50) Solid(0, 375, 250, 50) Solid(4, 425, 250) Solid(0, 450, 250, 50) Solid(13, 425, 200, 25, 15) Solid(13, 325, 275, 25, 15, 475) Solid(2, 325, 385, 175, 15) Solid(1, 325, 365, 50, 15, 450, 365, 200) EndFunc Func Level5() $Level=5 Solid(2, 100, 375) Solid(2, 225, 375) Solid(0, 250, 375, 50) Solid(2, 300, 375, 50) Solid(0, 350, 375) Solid(2, 375, 375) Solid(0, 400, 350, 100, 50) Solid(0, 450, 300, 25) Solid(0, 350, 250, 50) Solid(11, 363, 225, 20, 20) Solid(2, 300, 250, 50) Solid(0, 250, 275, 50) Solid(2, 175, 250, 75) Solid(2, 175, 225, 50) Solid(0, 125, 250, 50) Solid(2, 100, 100, 25, 100) Solid(11, 125, 225, 20, 20) Solid(11, 25, 225, 20, 20) Solid(11, 25, 175, 20, 20) Solid(11, 50, 125, 20, 20) Solid(11, 50, 75, 20, 20) Solid(0, 175, 100, 50) Solid(11, 300, 100, 20, 20) Solid(11, 375, 100, 20, 20) Solid(11, 425, 75, 20, 20) Solid(1, 475, 50) EndFunc Func Level4() $Level=4 Solid(0, 0, 400, 500) Solid(0, 125, 375, 125) Solid(0, 200, 350, 50, 25) Solid(0, 300, 325, 50, 50) Solid(0, 375, 325, 25, 50) Solid(0, 425, 300, 75, 50) Solid(0, 300, 225, 150, 25) Solid(0, 450, 250) Solid(0, 225, 250) Solid(0, 150, 200) Solid(0, 0, 300, 100) Solid(0, 50, 150, 25, 100) Solid(0, 25, 250) Solid(0, 0, 200) Solid(0, 425, 175, 75) Solid(0, 425, 125) Solid(0, 350, 125, 50) Solid(0, 275, 125) Solid(0, 150, 100, 75) Solid(0, 0, 100) Solid(0, 50, 50) Solid(0, 100, 0, 50) Solid(0, 150, 25, 75) Solid(0, 275, 25, 50) Solid(0, 375, 25, 125) Solid(1, 475, 0) EndFunc Func Level3() $Level=3 Text("Blocks can move!", 25, 300) Solid(4, 100, 375, 100) Solid(2, 200, 375, 175) Solid(0, 200, 350, 75, 25, 300, 350, 200) Solid(0, 375, 175, 125, 25, 375, 375, 200) Solid(0, 275, 175, 100) Solid(3, 75, 175, 200) Solid(0, 0, 175, 75) Solid(12, 0, 150, 20, 20) Solid(0, 100, 225, 75) Solid(1, 225, 200, 50) EndFunc Func Level2() $Level=2 Solid(0, 50, 375, 50) Solid(0, 125, 325, 100, 50) Solid(0, 250, 325, 100, 50) Solid(0, 400, 325, 75, 50) Solid(0, 0, 275, 100) Solid(0, 150, 225, 50) Solid(0, 250, 175, 75) Solid(0, 400, 200, 75) Solid(1, 475, 200) Text("Hit enter to restart. Hit esc to exit.", 300, 0, 8) EndFunc Func Level1() $Level=1 Solid(0, 100, 375, 100) Solid(2, 200, 375) Solid(0, 225, 375, 75) Solid(4, 300, 375, 125) Solid(13, 425, 385, 75, 15) Solid(13, 0, 125, 75, 15) Solid(0, 0, 250, 175) Solid(11, 100, 225, 20, 20) Solid(2, 175, 250, 75) Solid(0, 250, 250, 175) Solid(12, 320, 225, 20, 20) Solid(3, 375, 125, 50, 125) Solid(13, 425, 255, 75, 15) Solid(13, 0, 0, 75, 15) Solid(0, 0, 100, 125) Solid(5, 125, 100) Solid(5, 150, 100) Solid(5, 175, 100) Solid(5, 200, 100) Solid(0, 225, 100, 275) Solid(14, 300, 75, 20, 20) Solid(1, 450, 50, 50, 50) Text("Press up to jump", 0, 325, 8) Text("Avoid red", 180, 325, 8) Text("Sticky", 335, 325, 8) Text("Teleport", 435, 325, 8) Text("Jump in the air! Hit space to use", 15, 200, 8) Text("Lock and key", 285, 200, 8) Text("These vanish!", 130, 50, 8) Text("Use to pause moving", 240, 50, 8) Text("Hit to win!", 435, 20, 8) EndFunc Func Solid($_SolidType, $_SolidPosX, $_SolidPosY, $_SolidWidth=25, $_SolidHeight=25, $_SolidPosX_2=$_SolidPosX, $_SolidPosY_2=$_SolidPosY, $_SolidSpeed=100, $_SolidBrush=$SolidBrush[$_SolidType]) ReDim $Obj[$Obj_Num+1][14] ReDim $VanishTimer[$Obj_Num+1] ReDim $VanishBrush[$Obj_Num+1] ReDim $Vanish[$Obj_Num+1] $Obj[$Obj_Num][0]=$_SolidPosX $Obj[$Obj_Num][1]=$_SolidPosY $Obj[$Obj_Num][2]=$_SolidWidth $Obj[$Obj_Num][3]=$_SolidHeight $Obj[$Obj_Num][4]=$_SolidPosX_2 $Obj[$Obj_Num][5]=$_SolidPosY_2 $Obj[$Obj_Num][6]=Sqrt(($_SolidPosX_2-$_SolidPosX)^2+($_SolidPosY_2-$_SolidPosY)^2)/$_SolidSpeed If $_SolidPosX_2<>$_SolidPosX Then $Obj[$Obj_Num][7]=1 If $_SolidPosY_2<>$_SolidPosY Then $Obj[$Obj_Num][8]=1 If $_SolidPosX_2<>$_SolidPosX Then $Obj[$Obj_Num][9]=$_SolidPosX If $_SolidPosY_2<>$_SolidPosY Then $Obj[$Obj_Num][10]=$_SolidPosY $Obj[$Obj_Num][11]=$_SolidBrush $Obj[$Obj_Num][12]=$_SolidType $Obj[$Obj_Num][13]=1 If $_SolidType=5 Then $VanishBrush[$Obj_Num]=_GDIPlus_BrushCreateSolid(0xFF004400) If $_SolidType=5 Then $Vanish[$Obj_Num]=99 ReDim $Obj_DirectionX[$Obj_Num+1] ReDim $Obj_DirectionY[$Obj_Num+1] $Obj_DirectionX[$Obj_Num]=1 $Obj_DirectionY[$Obj_Num]=1 $Obj_Num+=1 EndFunc Func Text($_TextData, $_TextPosX, $_TextPosY, $_TextSize=10, $_TextFont="Arial") ReDim $Text[$Text_Num+1][5] $Text[$Text_Num][0]=$_TextData $Text[$Text_Num][1]=$_TextPosX $Text[$Text_Num][2]=$_TextPosY $Text[$Text_Num][3]=$_TextSize $Text[$Text_Num][4]=$_TextFont $Text_Num+=1 EndFunc Func DrawText() For $1=0 To $Text_Num-1 _GDIPlus_GraphicsDrawString($GDI_BACKBUFFER, $Text[$1][0], $Text[$1][1], $Text[$1][2], $Text[$1][4], $Text[$1][3]) Next EndFunc Func DrawObjects() For $1=0 To $Obj_Num-1 If $Obj[$1][7]=1 Then ;;;Turn Object Vertically $Obj[$1][0]+=$Obj[$1][6]*$Obj_DirectionX[$1] If $Obj[$1][0]=$Obj[$1][4] Then $Obj_DirectionX[$1]*=-1 If $Obj[$1][0]=$Obj[$1][9] Then $Obj_DirectionX[$1]*=-1 EndIf If $Obj[$1][8]=1 Then ;;;Turn Object Horisontally $Obj[$1][1]+=$Obj[$1][6]*$Obj_DirectionY[$1] If $Obj[$1][1]=$Obj[$1][5] Then $Obj_DirectionY[$1]*=-1 If $Obj[$1][1]=$Obj[$1][10] Then $Obj_DirectionY[$1]*=-1 EndIf If $Obj[$1][12]>10 Then If $Obj[$1][13]<>0 Then _GDIPlus_GraphicsFillEllipse($GDI_BACKBUFFER, $Obj[$1][0], $Obj[$1][1], $Obj[$1][2], $Obj[$1][3], $Obj[$1][11]) Else If $Obj[$1][13]<>0 Then _GDIPlus_GraphicsFillRect($GDI_BACKBUFFER, $Obj[$1][0], $Obj[$1][1], $Obj[$1][2], $Obj[$1][3], $Obj[$1][11]) EndIf Next EndFunc Func GetNewBallPos() If $BrownStop=True Then ;;;Brown Stop $BrownStopCount+=1 If $BrownStopCount>50 Then $BrownStop=False Return EndIf $IsSqueezed=0 If SurfaceRight() Then $BallDirection=2 If SurfaceLeft() Then $BallDirection=1 If $IsSqueezed=2 Then LoseGame() Switch $BallDirection Case 1 $BallPosX+=$BallSpeed Case 2 $BallPosX-=$BallSpeed EndSwitch EndFunc Func CheckVanish() For $1=0 To $Obj_Num-1 If $Obj[$1][12]=5 Then If $Obj[$1][13]=2 Then $Vanish[$1]-=2 _GDIPlus_BrushSetSolidColor($VanishBrush[$1], '0x' & $Vanish[$1] & '004400') $Obj[$1][11]=$VanishBrush[$1] If $Vanish[$1]<10 Then $Obj[$1][13]=0 $Vanish[$1]=99 $VanishTimer[$1]=TimerInit() EndIf ElseIf $Obj[$1][13]=0 And TimerDiff($VanishTimer[$1])>2000 Then $VanishTimer[$1]=TimerInit() If PointInSquare($BallPosX+$BallWidth, $BallPosY, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], -2, 1, 0) = False Then If PointInSquare($BallPosX+$BallWidth, $BallPosY+$BallHeight, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], -2, 1, 0) = False Then If PointInSquare($BallPosX, $BallPosY+$BallHeight, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], -2, 1, 0) = False Then If PointInSquare($BallPosX, $BallPosY, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], -2, 1, 0) = False Then _GDIPlus_BrushSetSolidColor($VanishBrush[$1], 0xFF004400) $Obj[$1][13]=1 $Obj[$1][11]=$SolidBrush[5] EndIf EndIf EndIf EndIf EndIf EndIf Next EndFunc Func MoveBall() Switch $Brush Case 1 _GDIPlus_GraphicsFillEllipse($GDI_BACKBUFFER, $BallPosX, $BallPosY, $BallWidth, $BallHeight, $GDI_BRUSH_BALL) Case 2 _GDIPlus_GraphicsFillEllipse($GDI_BACKBUFFER, $BallPosX, $BallPosY, $BallWidth, $BallHeight, $EpicBrush[0]) _GDIPlus_GraphicsFillEllipse($GDI_BACKBUFFER, $BallPosX+$BallWidth/8, $BallPosY+$BallHeight/8, $BallWidth-$BallWidth/4, $BallHeight-$BallHeight/4, $EpicBrush[1]) _GDIPlus_GraphicsFillEllipse($GDI_BACKBUFFER, $BallPosX+$BallWidth/4, $BallPosY+$BallHeight/4, $BallWidth-$BallWidth/2, $BallHeight-$BallHeight/2, $EpicBrush[2]) EndSwitch EndFunc Func WinGame() $Level+=1 $CryptKey="Juego" If $Level<9 And _Crypt_DecryptData(IniRead(@ScriptDir & "\JuegoData\CL.ini", "1", "1", ""), "Juego", $CALG_AES_256)<$Level Then IniWrite(@ScriptDir & "\JuegoData\CL.ini", "1", "1", _Crypt_EncryptData($Level, $CryptKey, $CALG_AES_256)) $ActivePowerup=0 $ExtraJumpActive=1 _GDIPlus_BrushSetSolidColor($GDI_BRUSH_BALL, 0xFF000000) $Jump=0 $JumpSoon=0 $SurfaceCount=0 $BallPosY=$BallPosY_Start $BallPosX=$BallPosX_0 ReDim $Obj[0][0] ReDim $Obj[1][14] ReDim $Text[0][0] ReDim $Text[1][5] $Obj_Num=0 $Text_Num=0 If $Level<9 Then RunLevel($Level) Else GoToMenu() EndIf $QualityCount=0 $QualityTimer=TimerInit() EndFunc Func LoseGame() For $1=1 To $Obj_Num-1 $Obj[$1][13]=1 $Vanish[$1]=99 _GDIPlus_BrushSetSolidColor($VanishBrush[$1], 0xFF004400) Next $ActivePowerup=0 $ExtraJumpActive=1 $Jump=0 _GDIPlus_BrushSetSolidColor($GDI_BRUSH_BALL, 0xFF000000) $BallPosY=$BallPosY_Start $BallPosX=$BallPosX_0 $SurfaceCount=0 $QualityCount=0 $QualityTimer=TimerInit() EndFunc Func SurfaceRight() If $BallPosX>=$WinWidth-$BallWidth Then Return True For $1=0 To $Obj_Num-1 If PointInSquare($BallPosX+$BallWidth, $BallPosY+$BallHeight/2, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], $Obj[$1][12], $Obj[$1][13], $1) Then If CheckForPowerup($1, $Obj[$1][12], $Obj[$1][13])= True Then Return False If $Obj[$1][7]=1 And $Obj[$1][6]>$BallSpeed Then $BallPosX=$Obj[$1][0]-$BallWidth If $Obj[$1][12]=2 Then LoseGame() If $Obj[$1][12]=1 Then WinGame() $IsSqueezed+=1 Return True EndIf Next EndFunc Func SurfaceLeft() If $BallPosX<=$BallPosX_0 Then Return True For $1=0 To $Obj_Num-1 If PointInSquare($BallPosX, $BallPosY+$BallHeight/2, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], $Obj[$1][12], $Obj[$1][13], $1) Then If CheckForPowerup($1, $Obj[$1][12], $Obj[$1][13])= True Then Return False If $Obj[$1][7]=1 And $Obj[$1][6]>$BallSpeed Then $BallPosX=$Obj[$1][0]+$Obj[$1][2] If $Obj[$1][12]=2 Then LoseGame() If $Obj[$1][12]=1 Then WinGame() $IsSqueezed+=1 Return True EndIf Next EndFunc Func SurfaceUnder() If $ExtraJumpActive=1 Or $ExtraJumpActive=2 Then If $ExtraJumpActive=2 Then $ExtraJumpActive=-1 $ExtraJumpActive+=1 Return True EndIf For $1=0 To $Obj_Num-1 If PointInSquare($BallPosX+$BallWidth-3, $BallPosY+$BallHeight+1, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], $Obj[$1][12], $Obj[$1][13], $1) Or PointInSquare($BallPosX+3, $BallPosY+$BallHeight+1, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], $Obj[$1][12], $Obj[$1][13], $1) Then If CheckForPowerup($1, $Obj[$1][12], $Obj[$1][13])= True Then Return False If $Obj[$1][12]=4 Then ;;;Gold Sticky If $BallDirection=1 Then $BallPosX-=0.75 If $BallDirection=2 Then $BallPosX+=0.75 EndIf $BallPosY=$Obj[$1][1]-$BallHeight $BallPosY_0=$BallPosY If $Obj[$1][12]=2 Then LoseGame() If $Obj[$1][12]=1 Then WinGame() Return True EndIf Next If $BallPosY+$BallHeight>=$WinHeight Then $BallPosY=$WinHeight-$BallHeight $BallPosY_0=$WinHeight-$BallHeight Return True EndIf EndFunc Func SurfaceOver() For $1=0 To $Obj_Num-1 If PointInSquare($BallPosX+$BallWidth-5, $BallPosY, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], $Obj[$1][12], $Obj[$1][13], $1) Or PointInSquare($BallPosX+5, $BallPosY, $Obj[$1][0], $Obj[$1][1], $Obj[$1][0]+$Obj[$1][2], $Obj[$1][1]+$Obj[$1][3], $Obj[$1][12], $Obj[$1][13], $1) Then If CheckForPowerup($1, $Obj[$1][12], $Obj[$1][13])= True Then Return False $SurfaceMove=0 If $Obj[$1][12]=2 Then LoseGame() If $Obj[$1][8]=1 Then $BallPosY=$Obj[$1][1]+$Obj[$1][3] $SurfaceMove=1 $SurfaceCount=5 ElseIf $BallPosY<$Obj[$1][1]+$Obj[$1][3]-2 Then $BallPosY=$Obj[$1][1]+$Obj[$1][3] EndIf If $Obj[$1][12]=1 Then WinGame() Return True EndIf Next EndFunc Func CheckForPowerup($__PowerupObjNum, $__PowerupObj, $__PowerupActive) If $__PowerupObj>10 Then If $__PowerupActive=0 Then Return True If $__PowerupObj<>13 Then $Obj[$__PowerupObjNum][13]=0 ActivatePowerup($__PowerupObj, $__PowerupObjNum) Return True EndIf Return False EndFunc Func ActivatePowerup($_PowerupType, $_PowerupObjNum) Switch $_PowerupType Case 11;;Superjump _GDIPlus_BrushSetSolidColor($GDI_BRUSH_BALL, 0xFFFF9900) Case 12;;Cyan Key For $1=0 To $Obj_Num-1 If $Obj[$1][12]=3 And $Obj[$1][13]=1 Then $Obj[$1][13]=0 Next $_PowerupType=$ActivePowerup Case 13;;Teleport If TimerDiff($TeleTimer)>500 Then $TeleLink=-1 If $Obj[$_PowerupObjNum-1][12]<>13 Then $TeleLink=1 $TeleDiffY=$BallPosY-$BallPosY_0 $BallPosX=$Obj[$_PowerupObjNum+$TeleLink][0]+$Obj[$_PowerupObjNum+$TeleLink][2]/2-$BallWidth/2 $BallPosY=$Obj[$_PowerupObjNum+$TeleLink][1]+$Obj[$_PowerupObjNum+$TeleLink][3]/2-$BallHeight/2 $BallPosY_0=$BallPosY-$TeleDiffY $TeleTimer=TimerInit() EndIf $_PowerupType=$ActivePowerup Case 14 _GDIPlus_BrushSetSolidColor($GDI_BRUSH_BALL, 0xFF734021) EndSwitch $ActivePowerup=$_PowerupType EndFunc Func SpendPowerup() Switch $ActivePowerup Case 0 Return Case 11 ;;;EXTRA JUMP $ActivePowerup=0 $ExtraJumpActive=1 $SurfaceCount=0 StartJump() Case 14 ;;;Brown Stop $BrownStop=True $BrownStopCount=0 EndSwitch _GDIPlus_BrushSetSolidColor($GDI_BRUSH_BALL, 0xFF000000) EndFunc Func StartJump() If SurfaceUnder() Then $Jump=True $BallPosY_0=$BallPosY ;~ $BallSpeedY=$JumpHeight $JumpSoon=False Else $JumpSoonTimer=TimerInit() $JumpSoon=True EndIf EndFunc Func Gravity() If SurfaceOver() = True Then $BallSpeedY=0 If $SurfaceMove=0 Then $SurfaceCount=2 $BallPosY_0=$BallPosY EndIf If SurfaceUnder() Then $SurfaceCount=0 $BallSpeedY=0 $BallPosY_0=$BallPosY If $JumpSoon=False And $Jump=False Then Return Else If $JumpSoon=True And TimerDiff($JumpSoonTimer)>150 Then Return $BallSpeedY=$JumpHeight StartJump() $Jump=False EndIf EndIf $SurfaceCount+=1 $BallPosY=$BallPosY_0-($BallSpeedY*$SurfaceCount+1/2*-9.81*$SurfaceCount^2)*0.01 EndFunc Func QualityCheck() $QualityCount+=1 If $QualityCount=$QualityFPS Then $QualitySleep+=(950-TimerDiff($QualityTimer))/$QualityFPS*100 $QualityCount=0 $QualityTimer=TimerInit() EndIf EndFunc Func USleep($iUsec, $hDLL = "ntdll.dll") $iUsec-=TimerDiff($USleepTimer)*100 If $iUsec<0 Then $iUsec=0 Local $hStruct = DllStructCreate("int64") DllStructSetData($hStruct, 1, -1 * ($iUsec * 10)) DllCall($hDLL, "dword", "ZwDelayExecution", "int", 0, "ptr", DllStructGetPtr($hStruct)) $USleepTimer=TimerInit() EndFunc Func PointInSquare($_PointX, $_PointY, $_SquareTopX, $_SquareTopY, $_SquareBottomX, $_SquareBottomY, $_SquareType, $_SquareActive, $_SquareObjNum) If $_SquareActive=0 Then Return False $_SquareDiff=0 If $_SquareType=2 Then $_SquareDiff=2 If $_SquareType>10 Then $_SquareDiff=2 If $_PointX<$_SquareTopX+$_SquareDiff Then Return False If $_PointX>$_SquareBottomX-$_SquareDiff Then Return False If $_PointY<$_SquareTopY+$_SquareDiff Then Return False If $_PointY>$_SquareBottomY-$_SquareDiff Then Return False If $_SquareType = 5 Then $Obj[$_SquareObjNum][13]=2 Return True EndFunc Func TakeSnapShot() If Not FileExists($PictureDir) Then DirCreate($PictureDir) _ScreenCapture_CaptureWnd($PictureDir & "\Temp.bmp", $hGUI, 0, 0, -1, -1, False) $___SnapShotImage = _GDIPlus_ImageLoadFromFile($PictureDir & "\Temp.bmp") $___GC = _GDIPlus_ImageGetGraphicsContext($___SnapShotImage) $___NewBmp = _GDIPlus_BitmapCreateFromGraphics(115,87,$___GC) $___newGC = _GDIPlus_ImageGetGraphicsContext($___NewBmp) _GDIPlus_GraphicsDrawImageRect($___newGC,$___SnapShotImage,0,0,115,87) _GDIPlus_ImageSaveToFile($___newBmp,$PictureDir & "\Level" & $Level & ".bmp") _GDIPlus_GraphicsDispose($___GC) _GDIPlus_GraphicsDispose($___newGC) _GDIPlus_BitmapDispose($___newBmp) _GDIPlus_ImageDispose($___SnapShotImage) FileDelete($PictureDir & "\Temp.bmp") $TakeScreenshot=False EndFunc Func Menu() $Level=0 $ButtonPosX=2 $ButtonPosY=2 For $1=1 To 16 $Button[$1]=GUICtrlCreateButton("", $ButtonPosX, $ButtonPosY, 120, 95, $BS_BITMAP) $ButtonPosX+=125 If $ButtonPosX>500 Then $ButtonPosX=2 $ButtonPosY+=100 EndIf GUICtrlSetImage($Button[$1], $PictureDir & "\Level" & $1 & ".bmp") If _Crypt_DecryptData(IniRead(@ScriptDir & "\JuegoData\CL.ini", "1", "1", ""), "Juego", $CALG_AES_256)<$1 And $1<9 And $1>1 Then GUICtrlSetState($Button[$1], 128) Next While 1 $msg=GUIGetMsg() For $1=1 To 16 Switch $msg ;~ Case $Button[1] ;~ DeleteMenu() ;~ Level1() ;~ Return Case $Button[$1] DeleteMenu() RunLevel($1) Return EndSwitch Next WEnd EndFunc Func RunLevel($_RunLevel) HotKeySet("{UP}", "StartJump") HotKeySet("{SPACE}", "SpendPowerup") HotKeySet("{PRINTSCREEN}", "TakeSnapShot") HotKeySet("{ENTER}", "LoseGame") Switch $_RunLevel Case 1 Level1() Case 2 Level2() Case 3 Level3() Case 4 Level4() Case 5 Level5() Case 6 Level6() Case 7 Level7() Case 8 Level8() Case 9 To 16 $Level=-1 LevelFromTxt($_RunLevel) EndSwitch $TakeScreenshot=True EndFunc Func DeleteMenu() For $1=1 To 16 GUICtrlDelete($Button[$1]) Next $QualityCount=0 $QualityTimer=TimerInit() EndFunc Func GoToMenu() If $ScriptPos=1 Then $GoToMenu=True Return EndIf $GoToMenu=False HotKeySet("{UP}") HotKeySet("{SPACE}") HotKeySet("{PRINTSCREEN}") HotKeySet("{ENTER}") _GDIPlus_GraphicsClear($GDI_BACKBUFFER, 0xFFFFFFFF) _GDIPlus_GraphicsDrawImageRect($GDI_GRAPHICS, $GDI_BITMAP, 0, 0, $WinWidth, $WinHeight) $ActivePowerup=0 $ExtraJumpActive=1 _GDIPlus_BrushSetSolidColor($GDI_BRUSH_BALL, 0xFF000000) $Jump=0 $JumpSoon=0 $SurfaceCount=0 $BallPosY=$BallPosY_Start $BallPosX=$BallPosX_0 ReDim $Obj[0][0] ReDim $Obj[1][14] ReDim $Text[0][0] ReDim $Text[1][5] $Obj_Num=0 $Text_Num=0 $QualityCount=0 $QualityTimer=TimerInit() Menu() EndFunc Func CheckActive() If WinActive($hGUI) Then If $WinActive=False Then HotKeySet("{UP}", "StartJump") HotKeySet("{SPACE}", "SpendPowerup") HotKeySet("{PRINTSCREEN}", "TakeSnapShot") HotKeySet("{ENTER}", "LoseGame") EndIf $WinActive=True Else If $WinActive=True Then HotKeySet("{UP}") HotKeySet("{SPACE}") HotKeySet("{PRINTSCREEN}") HotKeySet("{ENTER}") EndIf $WinActive=False EndIf EndFunc Func Terminate() If $Level<>0 Then GoToMenu() Return EndIf _GDIPlus_BrushDispose($SolidBrush[0]) _GDIPlus_BrushDispose($SolidBrush[1]) _GDIPlus_BrushDispose($SolidBrush[2]) _GDIPlus_BrushDispose($SolidBrush[3]) _GDIPlus_BrushDispose($SolidBrush[4]) _GDIPlus_BrushDispose($SolidBrush[5]) _GDIPlus_BrushDispose($SolidBrush[11]) _GDIPlus_BrushDispose($SolidBrush[12]) _GDIPlus_BrushDispose($SolidBrush[13]) _GDIPlus_BrushDispose($GDI_BRUSH_BALL) _GDIPlus_BrushDispose($VanishBrush) _GDIPlus_GraphicsDispose($GDI_GRAPHICS) _GDIPlus_ImageDispose($GDI_BITMAP) _GDIPlus_Shutdown() Exit EndFunc
    1 point
  9. could you add where you place ; Insert your code here to the code, the description that you use in "details about the event" ? TIA
    1 point
  10. Not sure if its possible but maybe you can tell us what program you're manipulating so we have a clear idea if its feasible. Or possibly just use the Window Info to check the controls of the program and see if their accessible.
    1 point
  11. 1 point
  12. mingre, This is how I did it some years ago: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> ;Global $bEditMode = True Global $iLineCount = 0 ; Keep a global count so we can check if it has changed $hGUI = GUICreate("Test", 200, 200) $cEdit_Num = GUICtrlCreateEdit("", 10, 13, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) $cEdit_Main = GUICtrlCreateEdit("", 36, 10, 96, 175) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 10, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUISetState(@SW_SHOW) AdlibRegister("_LineNum", 100) $sStuff = "" For $i = 1 To 20 GUICtrlSetData($cEdit_Main, "Blah " & $i & @CRLF, 1) Sleep(250) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount ($cEdit_Main) ;Check if the number of lines has changed in $cEdit_Main ;since this function was last called If $iCount <> $iLineCount Then ;save the new count to the global variable $iLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount ($cEdit_Num) If $iLineCount > $iNumCount Then For $i = $iNumCount + 1 To $iLineCount _GUICtrlEdit_AppendText ($cEdit_Num, @CRLF & $i) Next ElseIf $iLineCount < $iNumCount Then $text = GUICtrlRead($cEdit_Num) For $i = $iNumCount To $iLineCount + 1 Step -1 $text = StringReplace($text,@CRLF & $i,"") Next GUICtrlSetData($cEdit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($cEdit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFuncI will look at how I might update the code to use a message handler rather than Adlib. M23 Edit: And here it is: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> ; Create flag $bEditChanged = False Global $iLineCount = 0 ; Keep a global count so we can check if it has changed $hGUI = GUICreate("Test", 200, 200) $cEdit_Num = GUICtrlCreateEdit("", 10, 13, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) $cEdit_Main = GUICtrlCreateEdit("", 36, 10, 96, 175) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 10, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ; Example code only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iNewLine = 1 $nBegin = TimerInit() ; End of example code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; If flag set If $bEditChanged Then ; Adjust numbering if required _LineNum() ; Clear flag $bEditChanged = False EndIf ; Example code only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Add 20 lines - once every 250 msecs If TimerDiff($nBegin) > 250 And $iNewLine < 20 Then ; Add a line to show it working GUICtrlSetData($cEdit_Main, "Blah " & $iNewLine & @CRLF, 1) ; Increase count $iNewLine += 1 ; Reset timer $nBegin = TimerInit() EndIf ; End of example code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WEnd Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) ; If it was an update message from the edit If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $cEdit_Main Then ; Set the label to the new data $bEditChanged = True EndIf EndFunc ;==>_WM_COMMAND Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount ($cEdit_Main) ;Check if the number of lines has changed in $cEdit_Main ;since this function was last called If $iCount <> $iLineCount Then ;save the new count to the global variable $iLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount ($cEdit_Num) If $iLineCount > $iNumCount Then For $i = $iNumCount + 1 To $iLineCount _GUICtrlEdit_AppendText ($cEdit_Num, @CRLF & $i) Next ElseIf $iLineCount < $iNumCount Then $text = GUICtrlRead($cEdit_Num) For $i = $iNumCount To $iLineCount + 1 Step -1 $text = StringReplace($text,@CRLF & $i,"") Next GUICtrlSetData($cEdit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($cEdit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc
    1 point
  13. Hi dany, Thank you very much. I have modified the code according to the ur logic... just check the code and let me know... if any mistakes, correct me. ;This argument checks for the parameters which should not be a part of iimSet command. Global $nPreArgs = 0 ;This CheckArguments functions is where you determine if those parsed arguments satisfy your input and output requirements CheckArguments() ;Program Start ProgramStart() ;Your main program main() ;Program End ProgramEnd() Func CheckArguments() ;This first check is standard and is required in every scripts If isDeclared ("usage") Then consoleWrite($usageMsg) Exit EndIf ;Your checks start here ;Checking device under test Ip If not isDeclared("deviceIp") Then Global $deviceIp = EnvGet("encIp") Else $nPreArgs = $nPreArgs + 1 EndIf If eval("deviceIp" = "") Then KConsoleWrite("deviceIp is empty.",1) EndIf ;Checking imacrosFile If Not IsDeclared("imacrosFile") Then KConsoleWrite("Parameter not found: imacrosFile",1) Else $nPreArgs = $nPreArgs + 1 EndIf If StringRegExp(eval("imacrosFile"),'',0) = 0 Then Assign("imacrosFile", $kleverTestScriptsDir & "iMacros" & eval("imacrosFile"), 2) EndIf If Not FileExists(eval("imacrosFile")) Then KConsoleWrite("Imacro Script: "&eval("imacrosFile")&" is not existed."&@CRLF,1) EndIf ;Checking Extract Options if Not IsDeclared("outputFile") Then Assign("outputFile", @ScriptName & ".out", 2) Else $nPreArgs = $nPreArgs + 1 EndIf if IsDeclared("Comparison") Then $nPreArgs = $nPreArgs + 2 If not IsDeclared("Pattern") Then KConsoleWrite("Comparison option is given without Pattern option",1) EndIf EndIf if Not IsDeclared("isVisible") Then Global $isVisible="No" Else $nPreArgs = $nPreArgs + 1 EndIf if Not IsDeclared("checkWarningMsg") Then Global $checkWarningMsg="No" Else $nPreArgs = $nPreArgs + 1 EndIf EndFunc ;Modified code ; Global object pointer. Global $iMacros = 0 Func main() ; Only create an object when first initialized, otherwise re-use object pointer. If $iMacros = 0 Then $iMacros = ObjCreate("IMacros") Global $iRet If Not IsObj($iMacros) Then KConsoleWrite("IMacro Object not created successfully") KConsoleWrite("Closing Program", 1) Else if StringInStr($isVisible, "no") Then $iRet = $iMacros.iimInit("-tray") Else $iRet = $iMacros.iimInit() EndIf $count = 0 While $iRet = -1 $count = $count + 1 KConsoleWrite("IMacro not initialized successfully. Retrying") if StringInStr($isVisible, "no") Then $iRet = $iMacros.iimInit("-tray") Else $iRet = $iMacros.iimInit() EndIf Sleep(2000) If $count = 6 Then KConsoleWrite("IMacro not initialized successfully.") KConsoleWrite("Exiting with error code " & $iRet, 1) ExitLoop EndIf WEnd EndIf ;the two routines that you need to run Global $iMacroTorun = Eval("imacrosFile") Global $iMacroStatus $iMacros.iimDisplay("Testing is in Progress...") IMacrosSetArguments() $iMacroStatus = IMacrosPlay($iMacroTorun) IMacrosCheckError($iMacroStatus) ;Delete IMacros Object $iMacros.iimDisplay("Testing is finished...") ;$iMacros.iimExit() ;Handle Comparision if IsDeclared("Comparison") Then ;Read output file into variable local $text=KFileReadToArray(eval("outputFile")) if $text[0] = 0 Then KConsoleWrite("Imacros Ext gave empty output",1) EndIf ;stripping leading and trailing white spaces local $mytext = StringStripWS($text[1], 3) ;stripping any double quote char $mytext = StringReplace($mytext,'"',"") Switch eval("Comparison") Case "equal" if $mytext = eval("Pattern") Then KConsoleWrite("Equal passed: "&eval("Pattern")) Else KConsoleWrite("Equal failed: " & $mytext & ", while looking for " & eval("Pattern")) $programExitCode=1 EndIf Case "lessthan" if int($mytext) <= int(eval("Pattern")) Then KConsoleWrite("Less Than passed: " &$mytext & " is less than " & eval("Pattern")) Else KConsoleWrite("Less Than passed: " &$mytext & " is not less than " & eval("Pattern")) $programExitCode=1 EndIf Case "lessthanequal" if int($mytext) < int(eval("Pattern")) Then KConsoleWrite("Less Than passed: " &$mytext & " is less than or equal " & eval("Pattern")) Else KConsoleWrite("Less Than passed: " &$mytext & " is not less than or equal " & eval("Pattern")) $programExitCode=1 EndIf Case "greater" if int($mytext) > int(eval("Pattern")) Then KConsoleWrite("Less Than passed: " &$mytext & " is greater than " & eval("Pattern")) Else KConsoleWrite("Less Than passed: " &$mytext & " is not greater than " & eval("Pattern")) $programExitCode=1 EndIf Case "greaterequal" if int($mytext) >= int(eval("Pattern")) Then KConsoleWrite("Less Than passed: " &$mytext & " is greater than " & eval("Pattern")) Else KConsoleWrite("Less Than passed: " &$mytext & " is not greater than " & eval("Pattern")) $programExitCode=1 EndIf Case Else KConsoleWrite("Invalid Compare option: "&eval("Compare"),1) EndSwitch EndIf EndFunc ;Set all the IMacros Arguments. ;encIP is deviceIp ;we only need to provide other values Func IMacrosSetArguments() ;We can set the encIp automatically from the envget("encIP") $iMacros.iimSet("encIP", eval("deviceIp")) ;extraact dir and filename separately if outputfile is a fullpath Global $workingDir = @WorkingDir if (IsDeclared("outputFile") And StringInStr(Eval("outputFile"), "")) Then $fileArray = StringSplit($outputFile, "") if IsArray($fileArray) Then $workingDir = "" For $arrayIndex = 1 To $fileArray[0] - 1 $workingDirTemp = $fileArray[$arrayIndex] $workingDir = $workingDir & $workingDirTemp & "" Next Global $outputFile = $fileArray[$fileArray[0]] EndIf EndIf ;make sure workingdir path is created KDirCreate($workingDir) $iMacros.iimSet("outputDir", $workingDir) $iMacros.iimSet("outputFile", eval("outputFile")) ;extracting imacros arguments If(isarray($CmdLine)) Then For $arrayIndex = 1 to $CmdLine[0] Local $linesplit = StringSplit($CmdLine[$arrayIndex], "=", 1) If ($linesplit[1] = "imacrosFile") or ($linesplit[1] = "deviceIp") or ($linesplit[1] = "outputFile") or ($linesplit[1] = "isVisible") or ($linesplit[1] = "checkWarningMsg") or ($linesplit[1] = "logFile") or ($linesplit[1] = "imacrosFile") Then ;$iMacros.iimExit() ;KConsoleWrite("Arguments are entered in wrong order.", 1) Else $iMacros.iimSet($linesplit[1], $linesplit[2]) EndIf Next EndIf EndFunc func IMacrosPlay($iMacroTorun) $iMacroTorun = Chr(34) & $iMacroTorun & Chr(34) Local $iRet = $iMacros.iimPlay($iMacroTorun) if StringInStr($checkWarningMsg,"yes") Then $iMacros.iimPlayCode("TAG POS=1 TYPE=DIV ATTR=CLASS:warnbottomrule&&TXT:* EXTRACT=TXT") $extractValue = $iMacros.iimGetLastExtract() KConsoleWrite("The warning message is :" & $extractValue) EndIf Return $iRet EndFunc func IMacrosCheckError($error) If $error > 0 Then KConsoleWrite("IMacros: "&$imacrosFile& " ran successfully.", 0, 2) Else KConsoleWrite("IMacros: "&$imacrosFile& " errored: " & $iMacros.iimGetLastError(), 1) EndIf EndFunc
    1 point
×
×
  • Create New...