Jump to content

how to set file path value in browse button input box


Recommended Posts

hi all,

i tried to set the value in file path to browse button input box.but its not working.pls any one help me

 

my code,

While 1     
   Switch GUIGetMsg()         
       Case $Btn             
           $sPath = FileOpenDialog("Open a file", @desktopdir, "All file (*.*)") ;~       
           If $sPath Then GUICtrlSetData($EXCEL, FileGetShortName($sPath))             
           If $sPath Then GUICtrlSetData($EXCEL, $sPath)                     
    case  $Button1
                    $EXCEL1=GUICtrlRead($EXCEL)
                    ;$IP1=GUICtrlRead($IP)
                Global $sCellValue6 =""
;MsgBox(0, "Example", "Window is minimized")
Global $oIE=_IECreate($sCellValue6)
Sleep(1000)
Send("{F4}")
Sleep(2000)


Send("http://192.168.1.1/index.asp")
Send("{ENTER}")
sleep(1000)
Global $state=WinWait("Windows Security", "",4)
if BitAND($state,8)Then
   ControlSend("Windows Security", "", "Edit1", "admin")
   ControlSend("Windows Security", "", "Edit1", "{TAB}")
   Sleep(500)
   ControlSend("Windows Security", "", "Edit2","admin")
   ControlSend("Windows Security", "", "Edit2","{TAB}")
   Sleep(500)
   ControlSend("Windows Security", "", "DirectUIHWND1","{TAB}")
   ControlSend("Windows Security", "", "OK","{ENTER}")
  EndIf
   
   Sleep(10000)
   
   Global $oIE=_IECreate("http://192.168.1.1/Upgrade.asp")
   Global $file= _IEGetObjByName($oIE,"file")
   _IEFormElementSetValue($file,$EXCEL1)
   
   sleep(1000)
   
   also the browse button java script code
 
    <TR><script>draw_table(SUBFUN,"")</script>
        <TD colspan=2 class=FUNNAME1>&nbsp;<script>Capture(fwupgrade.upgradefile)</script>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type=file name=file size="26" ></TD></TR>
        <TR><script>draw_table(SUBFUN,"")</script>

    pls any body replay me

 

 

Link to comment
Share on other sites

Make the init dir parameter like this @desktopdir & ""

edit: actually that probably won't help, as this FileOpenDialog("Open a file", @desktopdir, "All file (*.*)") works fine for me.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("", 461, 69, 192, 124)
$Button1 = GUICtrlCreateButton("No Path Yet", 32, 16, 403, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $sPath = FileOpenDialog("Open a file", @desktopdir, "All file (*.*)")
            GUICtrlSetData($Button1, $sPath)
    EndSwitch
WEnd
Link to comment
Share on other sites

hai abberration

i want set the file path to browse button in the below code 

 <TR><script>draw_table(SUBFUN,"")</script>
        <TD colspan=2 class=FUNNAME1>&nbsp;<script>Capture(fwupgrade.upgradefile)</script>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type=file name=file size="26" ></TD></TR>
        <TR><script>draw_table(SUBFUN,"")</script>

 

replay me

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...