Using macro path in C#

krisztos

Client
Регистрация
28.06.2014
Сообщения
170
Благодарностей
8
Баллы
18
Some general question as I am not sure how tu use macro in c#:

Код:
img.Save(@"{-//-}"+i.ToString()+@".jpeg");
When using direct path in place of {-//-} the code does the job as it's supposed to.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 771
Благодарностей
1 183
Баллы
113

krisztos

Client
Регистрация
28.06.2014
Сообщения
170
Благодарностей
8
Баллы
18
OK I see some changes in whole C# code for making a screensot after I upgraded zennoposter. Lately this code worked:

Код:
HtmlElement he = instance.ActiveTab.FindElementByAttribute("body","fulltag","body","text",0);
int heHeight = Convert.ToInt32(he.GetAttribute("height"));
int heWidth = Convert.ToInt32(he.GetAttribute("width"));
int step =1000;
int countOfIterations = heHeight/step;
var bitmaps = new List<System.Drawing.Bitmap>();
int count =0;
for(int i =0;i<countOfIterations;i++)
{
    var text = he.DrawPartToBitmap(0, i*step, heWidth, step, true);
    byte[] imageBytes = Convert.FromBase64String(text);
    var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
    var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
    img.Save(project.Directory + i.ToString() + @".bpm");
    count++;
}
Now I got error:
Faulty operation: screenshot working fullof the action group id:
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Why dont you use Captcha Recognition with CaptchaSaver.dll module?
 

krisztos

Client
Регистрация
28.06.2014
Сообщения
170
Благодарностей
8
Баллы
18
Sure - I forgot about that method. Can we use there macro {-//-} for saving path?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Use project.Directory in C# code
 

krisztos

Client
Регистрация
28.06.2014
Сообщения
170
Благодарностей
8
Баллы
18
You mean save path in c# to variable and paste it in module settings of captcha saver? Can you give me some example?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
I'm not sure where you want to use this path {-//-}
 

krisztos

Client
Регистрация
28.06.2014
Сообщения
170
Благодарностей
8
Баллы
18
As a save path in module settings.

{-Project.Directory-}\{-Project.Name-}.png works fine

but

{-//-}\{-Project.Name-}.png

is not saving the file.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Why you wanna use {-//-}?
It's absolutely insane idea to send downloaded trash to system folder.
 

krisztos

Client
Регистрация
28.06.2014
Сообщения
170
Благодарностей
8
Баллы
18
It's only some temp image. In my case it's the folder I have opened, after checking image I am deleting it. Project is hidded in few another folders so {-Project.Directory-} would be a bad solution.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Use any other custom folder in this case
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)