2014-12-11 5 views
1

URL을 탐색하고 로그인 한 다음 특정 URL로 이동할 수 있습니다. 이제 나는 파일 업로드 레벨을 때렸다. 아무도 나를 도울 수 있습니까?Powerbuilder에서 웹 사이트에 액세스하고 파일 객체 제어를 위해 파일 업로드/매핑

변수 유형이 '파일'로오고, PB에서 파일 경로와 이름을 전달하는 법입니다. 다음은 내 스크립트

IE = CREATE OLEObject 
IE.ConnectToNewObject("InternetExplorer.Application") 

IE.left=200 
IE.top=200 
IE.height=400 
IE.width=400 
IE.menubar=1 
IE.toolbar=1 
IE.statusBar=1 
IE.navigate("http://www.xyz.in/index.php") 

IE.visible=1 
SetForegroundWindow(IE.HWND) 

DO WHILE IE.Busy 
    Yield() 
LOOP 

li_form_ctr = IE.Document.Forms.Length 
if li_form_ctr = 1 then 
    li_form_ctr = li_form_ctr - 1 
    IE.Document.Forms[li_form_ctr].Elements.username.Value = 'Test' 
    IE.Document.Forms[li_form_ctr].Elements.password.Value = '[email protected]' 
    ls_OldURL = IE.LocationURL 
    IE.Document.Forms[li_form_ctr].Elements.submit.Click() 
else 
    return 
end if 
DO WHILE IE.Busy 
Yield() 
LOOP 
if ls_OldURL = IE.LocationURL then 
    messagebox("Error","Either User Name/Password Wrong") 
else 
    IE.navigate("http://www.xyz.in/upload_ecr_latest.php") 
    DO WHILE IE.Busy 
    Yield() 
    LOOP 
    sleep(2) 
    li_form_ctr = 0 
    li_form_ctr = IE.Document.Forms.Length 
    if li_form_ctr = 1 then 
    li_form_ctr = li_form_ctr - 1 
    IE.Document.Forms[li_form_ctr].Elements.month.Value = '08' 
    IE.Document.Forms[li_form_ctr].Elements.year.Value = '2014' 
    IE.Document.Forms[li_form_ctr].Elements.ecr = "D:\temp\xyz.txt" -- This one is Not working 
    ls_OldURL = IE.LocationURL 
    IE.Document.Forms[li_form_ctr].Elements.upload.Click() 
    else 
     return 
    end if  
end if 

는 나라야나

답변

0

당신은 분명히 상황에 대한 작동 제어와 동기 형 통신을하고있는 것 같습니다이지만이 파일에 대해 잘 작동하는지 모르겠어요 업로드 여부.

"inet"개체에서 상속 받고 "internetresult"를 사용하여 navigatecomplete 등을 사용하여 결과를 얻을 수있는 자신 만의 자손을 만들 수 있다고 생각합니다. 사용할 수있는 인수가 포함될 이벤트 실제 페이로드 데이터

설명이 필요하면 알려주세요. 그러나 inet을 조사하면 인터넷 객체를 이해할 수있을 것입니다. 필요한 이벤트가 OLE 객체에서 사용 가능할 수 있지만 확실하지는 않습니다. 그런 식으로 한 적이 없습니다.

+0

나는 운이 좋음에도 불구하고 inet을 시도했지만 샘플 코드가 있다면 나에게 제공 할 수있다. 나는 또한 행운을 빌어 요 winhttp 방법을 시도했다. –