diff --git a/Tests/PS/BmpTest.simba b/Tests/PS/BmpTest.simba index e68871f..1f02016 100644 --- a/Tests/PS/BmpTest.simba +++ b/Tests/PS/BmpTest.simba @@ -1,76 +1,33 @@ program new; -//http://www.hawaiisunshine.org/wp-content/uploads/2008/12/sunshine1.jpg +//http://farm4.static.flickr.com/3067/2612399892_7df428d482.jpg +{Make the above bitmap your target} var Bmp : integer; x,y : integer; w,h : integer; begin - Bmp := BitmapFromString(37, 32, 'beNqFl3lwVuUVxp93veu3f1' + - 'lI+EKCLCkIAuI6oIBl0ylWweJerSm2atAaUJYgZCMLBAKyTSAh+w4' + - 'ERKnUpWoXERSBjtailDVACLS17Tj+13NvpB3tTHvnzOTOzb3vL+c5' + - 'azIGaIDMYMwQ3BBSkSkD4J4xCa4gNKQBZTClTS5tMBNQgAAY6C3mG' + - 'cN/zP/Wf0o3373oK0mfM8/E1UMMAa0YmZKQ4pvz6DUHzAJM3wwmpH' + - '/6t1j/D3f1He/Xyj/HFQgzhIEQEAHiQDIwAEjzbrjrQX2c7yNJwDn' + - '/5vh+Tb5l/3Vx77mhdFDLEEMMSPdtMDAGmMAwXWOWxWfb4s6APT4a' + - 'S5iBCDgRLT8KnjhcEJEJIgvP/ieOccPgZpDrsO/FIGAUcI8TeMwJP' + - 'heOLI/FVkZj5YFAuWEscANTw8lDnEgcMgQeBDd9hQXjQggu6ack+z' + - 'b0u5enHpAEZADXA3MDwSWZgwtSB5aG4+VmoBxGOfgqYC2wVNrjIaJ' + - 'gQV/nKBdh7rnpMPKUecnGhCI044xdzZ9+5tV40ZXMPenIo/ujumRk' + - '5oahA1cHCIEqsCqINZCV3Fpjhsp08CnDHe5RVAw86oeVLOoHN8W/T' + - '+YywpWnMPfj2h/d/iTm3xBHAHcHUDT2mi3jrqmISgJVK2yXvFbqjd' + - 'ysYGah4S5xQ08b1t1CDZMi4COygKHANcBYYHbmwEUzpg33JUoSgiB' + - 'aCWFKP+P75ca/U3j9iOH7pk2pHpRaAmwSaHJ0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dRyrt6MbtGW' + + 'VsWWTr6Q2/z0ieHzetjqfODoodzZ7PXT/f/q+v/+0PnyddHNUL6YW' + + '8V5cr1xx9Jq//Z8//7AqefNVM6sQLqL5PPZx+/litPUdd7hfNbhwN' + + '/V+f3Z//729P7/nufkPcS2aLuCzNNg/f1t/P7K////zvj3htXPRr2' + + 'Xm86f2vPIwubLgtTJb93aidfT6O7D+f/h///9svT0U7vJtcR8//hP' + + '//63//7/y/z5vfD1wOLPhNKgOaxpc7uRyeK1s+vFaNHNbtXS0uHI/' + + '/vK///8svD/hsbW+uiK//6v9f//z/j9suvzo9TWwOO2ud+qI6RZEK' + + 'lUbrxdl9qUV8q3Ub+6tNCz/Pmx/P/1xPP839/V+P2o//rmwPv/puH' + + 'swtvVqti1ptiftd+ZJ6NUIKlZIaVLL6xgQ7J/Lq93bbqB5eiY+f/k' + + 'xfX///fX//7X3fz/cd32wNvSs+O3sOScm9OeqtiJH6xIIKhWLKFRA' + + 'KJJEqJHN6FNHKNAW75dfdeddc/Yrd+3tuzOaefqRbnWq9Cdhtijld' + + 'WNmtWVoNF+MqxVJqlWJKJKG6I/UKs5hbtCWbNIQaVHYatXWq9yOq5' + + '8OqyGMaeZNKiMT7BuTrZ0aLpye8t0dspyM6xbL6dLLqBDJ6U8dKYy' + + '4upNx+J4yNt35OZ5yOh8W8eMRqNnQ6hWMqlTJaRXFaU5N6JBQrFIR' + + 'rdaKqlIL6ZNKqM8CKc5VZw04N8w//2m/vq5/v7M6vzghtfEhr+Ohc' + + 'NgYbRYU7lKUKo3O6k9K6s3KqQ/KKRILp8/D6k7GKZBMZwwqL86/P2' + + 'S9f/j//zlzP73nNrfpMeprdp0hMlyqcxincxYY7tXOLFHDehUEnQ=' + + ''); GetClientDimensions(w,h); if FindBitmapToleranceIn(bmp,x,y,0,0,w-1,h-1,25) then MoveMouse(x,y); diff --git a/Tests/PS/ColourTest2.simba b/Tests/PS/ColourTest2.simba index eb396f6..42e7658 100644 --- a/Tests/PS/ColourTest2.simba +++ b/Tests/PS/ColourTest2.simba @@ -1,4 +1,6 @@ program new; +const + bmppath = 'C:\Carina_1_by_Eeitam.png'; var p1, p2: TPointArray; w, h: integer; @@ -7,7 +9,7 @@ var begin SetColorToleranceSpeed(2); - bmp := LoadBitmap('/home/merlijn/Pictures/Mooi/Carina_1_by_Eeitam.png'); + bmp := LoadBitmap(bmppath); SetTargetBitmap(bmp); GetClientDimensions(W, H); writeln(inttostr(w) + ' : ' + inttostr(h)); diff --git a/Tests/PS/FileTests.simba b/Tests/PS/FileTests.simba index 5135302..467f7fc 100644 --- a/Tests/PS/FileTests.simba +++ b/Tests/PS/FileTests.simba @@ -19,7 +19,6 @@ program Hoi; } Const - TestPath = './test'; fsFromBeginning = 0; // offset must be pos or 0 fsFromCurrent = 1; // offset pos or neg @@ -27,10 +26,12 @@ Const var s, s2: string; + testPath : string; myFile, myFile2: Integer; begin - s := apppath; + testPath := scriptpath +'Test'; + s := ScriptPath; Writeln('Our current path is: ' + s); { If DirectoryExists(s) Then writeln('Directory ' + s + ' exists.'); } diff --git a/Tests/PS/MaskTest.simba b/Tests/PS/MaskTest.simba index 79db52e..60acfb6 100644 --- a/Tests/PS/MaskTest.simba +++ b/Tests/PS/MaskTest.simba @@ -1,5 +1,8 @@ program new; //http://nl.wikipedia.org/wiki/Lily_Allen +//This finds a mask of the text 'Op 24 september', +//so target wikipedia halfway down. Might not work because of +//different font's/sizes in your browser. var Bmp : integer; @@ -14,7 +17,7 @@ begin 'KvJQNKa5mEcyAhoauI6N8ymAlkxWpdtwgL2bhPXCJc7+E7JLNJsgG' + 'qQgL1jhHwX4VJdBsNZMbN5D//m/ob5XzwDp40wfg/jW9g024hbuPd' + 'ritabVqaAj7zYVyxg9fol4M8FFG7YAfIG00k='); - Mask := CreateBitmapMask(Bmp); + Mask := CreateMaskFromBitmap(Bmp); GetClientDimensions(w,h); // if FindBitmapMaskTolerance(Bmp,x,y,0, 0,w-1, h-1,1,5) then if FindMaskTolerance(Mask,x,y,0, 0,w-1, h-1,1,5) then diff --git a/Tests/PS/PathTest.simba b/Tests/PS/PathTest.simba index 415b1b3..6c89201 100644 --- a/Tests/PS/PathTest.simba +++ b/Tests/PS/PathTest.simba @@ -2,4 +2,7 @@ program new; begin Writeln(AppPath); Writeln(ScriptPath); + Writeln(IncludePath); + Writeln(FontPath); + writeln(PluginPath); end. diff --git a/Tests/PS/Several bitmap operations.simba b/Tests/PS/Several bitmap operations.simba index 5384114..7f616d6 100644 --- a/Tests/PS/Several bitmap operations.simba +++ b/Tests/PS/Several bitmap operations.simba @@ -1,6 +1,6 @@ program new; const - SaveDir = 'C:\'; + SaveDir = ScriptPath; var Bmpz : integer; Bmp2 : integer; diff --git a/Tests/PS/SimpleBMPLoader.simba b/Tests/PS/SimpleBMPLoader.simba index 0b3ed62..0b82cd0 100644 --- a/Tests/PS/SimpleBMPLoader.simba +++ b/Tests/PS/SimpleBMPLoader.simba @@ -1,4 +1,6 @@ program new; +const + savepath = scriptpath; var Bmpz : integer; w,h : integer; @@ -134,9 +136,9 @@ begin GetBitmapSize(bmpz,w,h); Writeln(inttostr(w) + '-' + inttostr(h)); SetBitmapSize(Bmpz,w div 2, h div 2); - SaveBitmap(Bmpz,'/tmp/test.bmp'); + SaveBitmap(Bmpz,savepath + 'test.bmp'); //FreeBitmap(Bmpz); - Bmpz := LoadBitmap('/tmp/test.bmp'); + Bmpz := LoadBitmap(savepath + 'test.bmp'); SetBitmapSize(bmpz,w,h); - SaveBitmap(Bmpz,'/tmp/test2.bmp'); + SaveBitmap(Bmpz,savepath + 'test2.bmp'); end. diff --git a/Tests/PS/Uptext.simba b/Tests/PS/Uptext.simba index e612331..ce8b237 100644 --- a/Tests/PS/Uptext.simba +++ b/Tests/PS/Uptext.simba @@ -5,6 +5,6 @@ begin t:=getsystemtime; for i := 0 to 100 do rs_getuptext; - writeln(inttostr(round(getsystemtime - t) / 100)); + writeln(floattostr(round(getsystemtime - t) / 100.0)); writeln(rs_getuptext); end. diff --git a/Tests/PS/blackchat.simba b/Tests/PS/blackchat.simba index 24297e6..989878e 100644 --- a/Tests/PS/blackchat.simba +++ b/Tests/PS/blackchat.simba @@ -22,23 +22,10 @@ begin if (FindColorsTolerance(cArr, TextCol, MCX1, P.y, MCX2, P.y + 13, 0)) then begin B := GetTPABounds(cArr); - // Result := GetTextAt(B.x1 - 1, B.y1 - 1, 1, 3, 0, 0, 0, 100, 'SmallChars'); - - {Result := Trim(GetTextAtEx(B.x1 - 1, B.y1 - 2, 0, SmallChars, False, False, - 0, 1, TextCol, 80, False, tr_AllChars)); } + Result := GetTextAt(B.x1 - 1, B.y1 - 1,1, 4, 1, 0, 0, 100, 'SmallChars'); end; end; -var - bmp: integer; begin - bmp := LoadBitmap('/home/merlijn/Programs/trunk/pics/17.bmp'); - SetTargetBitmap(bmp); - // freebitmap(bmp); -{ GetChatBoxText(8, 0); } - - {SetDesktopAsClient; } - - // uncomment this for exception - freebitmap(bmp); + Writeln(GetChatBoxText(8, 0)); end. diff --git a/Tests/PS/dtmtest.simba b/Tests/PS/dtmtest.simba index ccc764d..264e8b5 100644 --- a/Tests/PS/dtmtest.simba +++ b/Tests/PS/dtmtest.simba @@ -15,8 +15,7 @@ begin movemouse(x,y); end else writeln('not found'); - if getdtm(dtm, ppdtm) then - writeln('yay'); + ppdtm := GetDTM(Dtm); printpdtm(tdtmtopdtm(pdtmtotdtm(ppdtm))); dtm := addpdtm(ppdtm); freedtm(dtm); diff --git a/Tests/PS/dtmtest2.simba b/Tests/PS/dtmtest2.simba index 48fbddb..1bb0d3f 100644 --- a/Tests/PS/dtmtest2.simba +++ b/Tests/PS/dtmtest2.simba @@ -53,7 +53,7 @@ begin movemouse(p[0].x,p[0].y); end; - if FindDTMRotated(dtm, x, y, 0, 0, w-1, h-1, -3.14, 3.14, 0.05, a) then + if FindDTMRotatedAlternating(dtm, x, y, 0, 0, w-1, h-1, -3.14, 3.14, 0.05, a) then begin writeln('Found DTM at ' + inttostr(x) + ', ' + inttostr(y) + ' Angle: ' + FloatToStr(a)); movemouse(x,y); diff --git a/Tests/PS/plugintest.simba b/Tests/PS/plugintest.simba index 7e39942..82e33b0 100644 --- a/Tests/PS/plugintest.simba +++ b/Tests/PS/plugintest.simba @@ -59,6 +59,6 @@ begin writeln(inttostr(w) + ' , ' + inttostr(h)); if findcolortolerance(w,h,clwhite,0,0,764,502,300) then smartmovemouse(w,h); - savescreenshot('/tmp/smart.bmp'); - //Wait(5000); + Wait(5000); + savescreenshot(scriptPath + 'smart.bmp'); end. diff --git a/Tests/PS/settings_test.simba b/Tests/PS/settings_test.simba index 1f257ab..e857af2 100644 --- a/Tests/PS/settings_test.simba +++ b/Tests/PS/settings_test.simba @@ -1,17 +1,16 @@ program new; begin -SettingsGetSetDefaultKeyValue('Kanker/wat', 'YO WAT'); -SettingsGetSetDefaultKeyValue('Kanker/wat2', 'YO WAT2'); -writeln(SettingsGetKeyValue('Kanker/wat')); - -if SettingsIsDirectory('Kanker') then - writeln('Kanker has at least one child!'); -if SettingsIsKey('Kanker/wat') then - writeln('wat exists!'); -SettingsDeleteKey('Kanker/wat'); -writeln(SettingsGetKeyValue('Kanker/wat2')); -writeln(SettingsGetKeyValue('Kanker/wat')); -SettingsDeleteSubKeys('Kanker'); -if SettingsIsKey('Kanker') then - writeln('kanker is a key now!'); + GetSettingValueDef('Testme/wat','Yo wat'); + GetSettingValueDef('Testme/wat2','Yo wat2'); + Writeln(GetSettingValue('Testme/wat')); + if KeyIsDirectory('Testme') then + Writeln('Testme has atleast one child!'); + if KeyIsSetting('Testme/wat') then + writeln('wat exists in the parent Testme!'); + DeleteSetting('Testme/wat'); + Writeln(GetSettingValue('Testme/wat2')); + Writeln(GetSettingValue('Testme/wat')); + writeln(DeleteSubSettings('Testme')); + if KeyIsSetting('Testme') then + writeln('Testme is a key now!'); end. diff --git a/Tests/PS/stringtest.simba b/Tests/PS/stringtest.simba index c3e911a..6bd81cc 100644 --- a/Tests/PS/stringtest.simba +++ b/Tests/PS/stringtest.simba @@ -34,6 +34,4 @@ begin end; Writeln(y); Writeln(TPointArray([Point(5,5),Point(20,1337),point(1,2)])); - J := TForm.Create(nil); - Writeln(j.canvas); end.