Ram Posted November 22, 2007 Share Posted November 22, 2007 Hi,I have a website that has form where the user enters details... Now I would like to run a script according to the details entered in the form. For eg:User enters data in the website. The output is stored in the backhand (Excel file). Once the output is recieved the script has to be excuted according to the data entered in the output. Is this possible? I have the script that can get the data and enter data into the software but I am not sure how do get the data from the webserver and also trigger the script once the file is recieved? How di go about doing this? Can this be done through Autoit?Awaiting your response!Thanks! Link to comment Share on other sites More sharing options...
DaleHohm Posted November 22, 2007 Share Posted November 22, 2007 Do you want the data to go to the webserver as well? Can you explain why you are wanting to do this please? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Ram Posted November 24, 2007 Author Share Posted November 24, 2007 Do you want the data to go to the webserver as well? Can you explain why you are wanting to do this please?DaleSorry for the delay Dale.I am doing a small project. I have software that I created. User needs to enter data to the software and which gives quotation to products selected. This is done offline which is an easy process because I know there is wonderful software called AuotIT it can be used solve my offline issue.Now, the next version is that n user needs to enter their personal info and their desired product quotation. This input will be stored and we have to get that data and attach it to the offline module. For eg:Offline: user enters data in the excel file and executes the script. Get the quotation. Online: user logins to his account and enters data in the form and input is taken as excel file. But they don't have access to the script to execute it. (with regards to getting the value to the user - I am going to send quoation back by email.)The excel is created on the back hand (on my webserver). Now, I know a way to get the excel file moved to the required directory. but I am looking for a way where once the excel is created by the user. The script needs to know the excel file is created and it needs to open the required script? is this possible? so how do I go about doing it? Can you help me out figuring out this logic?Awaiitng your response! Link to comment Share on other sites More sharing options...
DaleHohm Posted November 24, 2007 Share Posted November 24, 2007 (edited) This example will show you an approach using events to capture information from the page and then take some actions... expandcollapse popup#include <IE.au3> $s_html = "" $s_html &= "<HTML>" & @CR $s_html &= "<HEAD>" & @CR $s_html &= "<TITLE>Event Example</TITLE>" & @CR $s_html &= "<STYLE>body {font-family: Arial}</STYLE>" & @CR $s_html &= "</HEAD>" & @CR $s_html &= "<BODY>" & @CR $s_html &= "<input type='text' name='textExample' value='Some Sample Text' size='40'>" & @CR $s_html &= "<BR>" & @CR $s_html &= "<BUTTON name=myButton1 TYPE=Button>Get Value</BUTTON>" & @CR $s_html &= "<BUTTON name=myButton2 TYPE=Button>Quit</BUTTON>" & @CR $s_html &= "</BODY>" & @CR $s_html &= "</HTML>" $oIE = _IECreate() _IEDocWriteHTML($oIE, $s_html) $oTextBox = _IEGetObjByName($oIE, "textExample") $oButton1 = _IEGetObjByName($oIE, "myButton1") $oButton2 = _IEGetObjByName($oIE, "myButton2") $oEvt = ObjEvent($oButton1, "Evt1_") $oEvt = ObjEvent($oButton2, "Evt2_") While 1 Sleep(200) WEnd Func Evt1_onclick() MsgBox(0, "TextArea Example", _IEFormElementGetValue($oTextBox)) EndFunc Func Evt2_onclick() _IEQuit($oIE) Exit EndFunc Dale Edited November 24, 2007 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Oldschool Posted November 24, 2007 Share Posted November 24, 2007 _IE rules Awesome example Link to comment Share on other sites More sharing options...
Ram Posted November 25, 2007 Author Share Posted November 25, 2007 This example will show you an approach using events to capture information from the page and then take some actions... expandcollapse popup#include <IE.au3> $s_html = "" $s_html &= "<HTML>" & @CR $s_html &= "<HEAD>" & @CR $s_html &= "<TITLE>Event Example</TITLE>" & @CR $s_html &= "<STYLE>body {font-family: Arial}</STYLE>" & @CR $s_html &= "</HEAD>" & @CR $s_html &= "<BODY>" & @CR $s_html &= "<input type='text' name='textExample' value='Some Sample Text' size='40'>" & @CR $s_html &= "<BR>" & @CR $s_html &= "<BUTTON name=myButton1 TYPE=Button>Get Value</BUTTON>" & @CR $s_html &= "<BUTTON name=myButton2 TYPE=Button>Quit</BUTTON>" & @CR $s_html &= "</BODY>" & @CR $s_html &= "</HTML>" $oIE = _IECreate() _IEDocWriteHTML($oIE, $s_html) $oTextBox = _IEGetObjByName($oIE, "textExample") $oButton1 = _IEGetObjByName($oIE, "myButton1") $oButton2 = _IEGetObjByName($oIE, "myButton2") $oEvt = ObjEvent($oButton1, "Evt1_") $oEvt = ObjEvent($oButton2, "Evt2_") While 1 Sleep(200) WEnd Func Evt1_onclick() MsgBox(0, "TextArea Example", _IEFormElementGetValue($oTextBox)) EndFunc Func Evt2_onclick() _IEQuit($oIE) Exit EndFunc Dale this is nice.. but can this script be running all the time? meaning keeping waiting till there is some event? Link to comment Share on other sites More sharing options...
DaleHohm Posted November 25, 2007 Share Posted November 25, 2007 (edited) this is nice.. but can this script be running all the time? meaning keeping waiting till there is some event?That's what this does: While 1 Sleep(200) WEnd I'm guessing that you need to share more details about what you are really trying to accomplish. If this is not adequate, you need to try to build upon it to make it what you need or you need to ask more specific questions that will lead you there. Dale Edited November 25, 2007 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Ram Posted November 26, 2007 Author Share Posted November 26, 2007 (edited) That's what this does: While 1 Sleep(200) WEnd I'm guessing that you need to share more details about what you are really trying to accomplish. If this is not adequate, you need to try to build upon it to make it what you need or you need to ask more specific questions that will lead you there. Dale Probably this might help you out in what I trying achieve... I will be storing all the input forms in a particular location as an excel file. once this is done. This specific script needs to keep checking the specific folder once the file is created in webserver folder location. The script needs to trigger conditions accordingly and start the other scripts. Is this possible? The whole process is done on a local webserver no 3rd party webservice! When I was typing this message I figured out I will not able to use your example script because I am running on a webserver and not on a location machine So I tried this: While 1 Sleep(200) WEnd If FileExists("D:\Test\Test.xls") Then MsgBox (0, "TEST", "Test") EndIf but the above script didn't do anything? Did I do any mistake? Edited November 26, 2007 by Ram Link to comment Share on other sites More sharing options...
DaleHohm Posted November 26, 2007 Share Posted November 26, 2007 (edited) You said you wanted this done offline. Now you are saying it is all on the webserver. You have me confused. You'll need to give a more careful description. Regarding your question with the While loop... it will never exit that loop... the reason that my example does is because it uses event triggers to temporarliy leave the While and execute the other function... Dale Edited November 26, 2007 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Ram Posted November 26, 2007 Author Share Posted November 26, 2007 You said you wanted this done offline. Now you are saying it is all on the webserver. You have me confused. You'll need to give a more careful description.Regarding your question with the While loop... it will never exit that loop... the reason that my example does is because it uses event triggers to temporarliy leave the While and execute the other function...DaleSorry that I confused you with my description. Yep. I want a way to trigger my other script as soon as the file is created?Is there any event trigger function for this problem? Link to comment Share on other sites More sharing options...
DaleHohm Posted November 26, 2007 Share Posted November 26, 2007 Sorry that I confused you with my description. Yep. I want a way to trigger my other script as soon as the file is created?Is there any event trigger function for this problem?As soon as what file is created? Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Ram Posted November 26, 2007 Author Share Posted November 26, 2007 As soon as what file is created?Hey Dale. Looks like you didn't understand what I am trying to achieve. Ok I will explain again.This is what I trying to achieve.I have few scripts that can get data from excel file enter the data into particular software to get quotation for different products. This excel file is created manually by me. Now I am looking to get this excel created automatically. So for that I have webserver, in the same machine I have autoit running. I have a form that has all the input. when I clik submit this will create an excel file in the webserver location. so now I am looking for a way once the excel file is created in the location I want autoit to trigger the script (that i have created already) automatically. Hence that is why I asked a question is there a way to trigger the script as soon as the file is created in the location?Hope this helps you out. Link to comment Share on other sites More sharing options...
Generator Posted November 26, 2007 Share Posted November 26, 2007 Hey Dale. Looks like you didn't understand what I am trying to achieve. Ok I will explain again.This is what I trying to achieve.I have few scripts that can get data from excel file enter the data into particular software to get quotation for different products. This excel file is created manually by me. Now I am looking to get this excel created automatically. So for that I have webserver, in the same machine I have autoit running. I have a form that has all the input. when I clik submit this will create an excel file in the webserver location. so now I am looking for a way once the excel file is created in the location I want autoit to trigger the script (that i have created already) automatically. Hence that is why I asked a question is there a way to trigger the script as soon as the file is created in the location?Hope this helps you out.Didn't quite get the whole thread, but base on your description, maybe try InetGetSize ( "URL" )? Link to comment Share on other sites More sharing options...
DaleHohm Posted November 26, 2007 Share Posted November 26, 2007 Hey Dale. Looks like you didn't understand what I am trying to achieve. Ok I will explain again.This is what I trying to achieve.I have few scripts that can get data from excel file enter the data into particular software to get quotation for different products. This excel file is created manually by me. Now I am looking to get this excel created automatically. So for that I have webserver, in the same machine I have autoit running. I have a form that has all the input. when I clik submit this will create an excel file in the webserver location. so now I am looking for a way once the excel file is created in the location I want autoit to trigger the script (that i have created already) automatically. Hence that is why I asked a question is there a way to trigger the script as soon as the file is created in the location?Hope this helps you out.So your question has nothing to do with the web browser and nothing to do with processing on the client and nothing to do with "offline" clients, regardless of what your previous posts in this thread say. Ok.Your question is, is there a way to trigger the execution of an autoit script when a particular file gets created on a machine, which happens to be a webserver (but the fact that it is a webserver is not actually relevant to the core question)?Please confirm this is what you are asking.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Ram Posted November 27, 2007 Author Share Posted November 27, 2007 So your question has nothing to do with the web browser and nothing to do with processing on the client and nothing to do with "offline" clients, regardless of what your previous posts in this thread say. Ok.Your question is, is there a way to trigger the execution of an autoit script when a particular file gets created on a machine, which happens to be a webserver (but the fact that it is a webserver is not actually relevant to the core question)?Please confirm this is what you are asking.DaleYep you are right. is there any way? Link to comment Share on other sites More sharing options...
DaleHohm Posted November 27, 2007 Share Posted November 27, 2007 Sigh. There is no way I know of to make file system changes trigger events - the Scripting.FileSystemObject does not expose events. You'll need to use a polling loop to watch for file existence or update time and then take action. Something like this: $FileTWatchFor = "C:\mtfile.txt" While 1 While Not FileExists($FileTWatchFor) Sleep(15000) ; Sleep 15 seconds WEnd OpenParseDelete() WEnd Func OpenParseDelete() ; insure another process doesn't have the file open ; open the file ; parse contents ; do something with the contents ; delete file Return EndFunc Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now