Jump to content

Program runing with script need a .dll


Ulizeus
 Share

Recommended Posts

This my second day using this great program, maked a script that runs a external program, just as simple as

Run ("pathfile/file.exe")

Sleep (2000)

This script is called from another script that is always active (main script), It runs correctly, but it dont load runing it this way, If I run the script manually, it runs without any problems, but the script need to be in the same dir as the Program, or the .dll of the program need to be in the same dir as the script.

The main problem is that It needs to be loaded and unloaded several times with the main script, theres a way to point the .dll to the program? so it always know where it is, I tried to put the .dll in different directories, but no luck, thx in advance :).

Link to comment
Share on other sites

This my second day using this great program, maked a script that runs a external program, just as simple as

Run ("pathfile/file.exe")

Sleep (2000)

This script is called from another script that is always active (main script), It runs correctly, but it dont load runing it this way, If I run the script manually, it runs without any problems, but the script need to be in the same dir as the Program, or the .dll of the program need to be in the same dir as the script.

The main problem is that It needs to be loaded and unloaded several times with the main script, theres a way to point the .dll to the program? so it always know where it is, I tried to put the .dll in different directories, but no luck, thx in advance :).

Hmmm -

First, I'd give the full path, not just a folder name. Second, I'd specify the working directory in the call to Run. Also, if the pathfile folder is under a standard system folder like the "My Documents", I'd use an AutoIt macro to define it - @MyDocumentsDir - instead of hard coding the directory. This is particularly important now that Microsoft has decided to change from using "C:\Documents and Settings" to "C:\Users" in Vista! So, assuming the pathfile folder is under My documents, the code would be

Run ( '"' & @MyDocumentsDir & '\pathfile\file.exe"', @MyDocumentsDir & '\pathfile' )oÝ÷ ØÚ-^ºÇ¨}Ú.nWªº^²ÚË«y§v¬mjÛ^m¡ì^^ªê-Ov.éí²«¨·br­Â)ev"Ç¢·¥«±ëh¶»-­zÊZqì".¶Ø^ªê-)­çÞ®Ú.±ë"    ^ªê-zÆ«¢éݲÚâ0'!jYhÂɶ¬yÚ.nWªº^³­­«âhvaz磨ºÊ®¢Ö¦¤(kߦ¦«¨·*.±ç©z^­çZZ/zµA±Êâ¦Û7Ü  òÁ¬iÉ-£*.®â)Ú«²Ø¨'íàË.+"Ø^±©v*ÞrÚ+É«WÅëaz趦².Ü(®BÝý²z-²ü¢ayØ«yËh¯+ajحȧjËa{
+)àv*ÞrÚ+Êf²~,b´ëaz¼"±ì¨ºf²ç¶Þ+-z»ayÙejëh×6Run ( '"' & @SystemDir & '\regsvr32.exe" /s "' & @MyDocumentsDir & '\pathfile\file.dll"' )
Yea, I know, I've never seen the System directory someplace where it would need quotes around it, but you never know when someone is going to be clever and specify "C:\New Windows" as the default Windows directory (yes, I've run into it!)!

BTW I was surprised to learn that AutoIt can use either "\" or "/" as the folder separator!

Edited by JerryD
Link to comment
Share on other sites

The forst option seems to be working great, the second 1 isnt, when I tried to manually reg it, I got memory acces error. Thx Lots JerryD

Now, I have another port of the script, where It check if a program frozen, and try to terminate it, look like this

If WinExists ("Prog1") = 1 Then ;check main prog
                    If ProcessExists ("Prog2") = 1 Then ;check another sidewalk prog
                        ProcessClose ("Prog2") ;closes if exist
                        Sleep (500)
                    EndIf
                    WinActivate ("Prog1")
                    Sleep (200)
                    ;Send ("{ALTF4}", 1)
                    WinClose ("Prog1") ;Try to close main
                    Sleep (200)
                        If WinWait ("End Program - Prog1") = 1 Then ;check for force close
                            ;WinActivate ("End Program - Prog1")
                            Sleep (200)
                            ControlClick ("End Program - Prog1", "", "[CLASS:Button; TEXT:&End Now ;INSTANCE:1]", 1 ) ;Try to click End Now
                            Sleep (2000)
                        EndIf
                EndIf

But it never click End Now, instead, he try to close it 3 times and then continue the script.

Any clues of what im doing wrong, tried lots of different combinations of the way to close like winkill, or alf-f4, but the problem is always the end now button, thx again for ur time.

Link to comment
Share on other sites

The forst option seems to be working great, the second 1 isnt, when I tried to manually reg it, I got memory acces error. Thx Lots JerryD

Glad it helped. If the first method worked, you shouldn't register the DLL anyway - and not all DLL's are made to be registered anyway!

As for the latest, I've only used the text of a control for ControlClick and had no problems

ControlClick ("End Program - Prog1", "", "&End Now" ) ;Try to click End Now
one click is the default, so you shouldn't need that either.
Link to comment
Share on other sites

Glad it helped. If the first method worked, you shouldn't register the DLL anyway - and not all DLL's are made to be registered anyway!

As for the latest, I've only used the text of a control for ControlClick and had no problems

ControlClick ("End Program - Prog1", "", "&End Now" ) ;Try to click End NowƒoÝŠ÷ Ú‰ÞrXœ’+-…ç^}«¥¶Ê2¢ë!¢é]Ÿm維z+az¿êº‹^aæ¡Á«-¯(§‚Z-²‡Ý‰÷Þ­éír‰›¢Æ§vÚâyÛhzÊ^r'òjÉ®r¬¦‹,‰¹^jwZu׶µrXœ’Šm¡ÈŸŠÜ²h¬±çh®Ê&zØbž^…äáŠÌ(®Gj¢©ò‰×š³r¶¬v'g·
+‘çpŠØB¢{k¢R¦º)z»bzÄèšç!­çnÖ§¶)ߢf²mäáÄ—«¯ ç£
ejËj¹ë-Š‰È½ç.®·§¶®²)àjz%±Êâ¦Ùb‘ëaŠËh®éæÊÇ+Š›nžØ¥"f§¹©eÉÉh±è­–Š$²X¤zØb±«­¢+Ù±½‰…°€˜ŒÀÌØíA…ÕÍ•)!½Ñ-•åM•Ð ™ÅÕ½Ðíí9ô™ÅÕ½Ðì°€™ÅÕ½ÐíQ½±•A…ÕÍ”™ÅÕ½Ðì¤)!½Ñ-•åM•Ð ™ÅÕ½Ðíí!=5ô™ÅÕ½Ðì°€™ÅÕ½ÐíQ•Éµ¥¹…Ñ”™ÅÕ½Ðì¤()]¡¥±”€Ä(€€€M±••À ÄÀÀ¤)]¹(í¡•É”½•Ì„±¥¹”Ñ¡…С•¬Ñ¡”±…Íе‘¥™¥•Ñ¥µ”½˜Ñ¡”±½œ°…¹É•ÑÕɸ¥Ð¥¸µ¥¹ÕÑ•Ì)Õ¹ŒQ½±•A…ÕÍ” ¤(€€€€˜ŒÀÌØíA…ÕÍ•€ô9=P€˜ŒÀÌØíA…ÕÍ•(€€€]¡¥±”€˜ŒÀÌØíA…ÕÍ•€€€€€€€€€€€€€€€€í…™Ñ•ÈÑ¡¥Ì°¥Ð¡•¬¥˜Ñ¡”Ñ¥µ”¥¸µ¥¹ÕÑ•Ì€™ÐìÑ¡…¸„•ÉÑ…¥¸Ù…±Õ”(€€€€€€€Í±••À ÄÀÀ¤(€€€€€€€€í¡•É”½•Ì…±µ½ÍÐ…±°Ñ¡”½‘”½˜Ñ¡”ÍÉ¥Áаµ…¥¹±ä¡•­¥¹œ¥˜Ñ¡”Áɽœ¥Ì™É½é•¸½ÈÑ¡”Í¥‘”Áɽœ¥ÌÉÕ¹¹¥¹œ(€€€]¹)¹‘Õ¹Œ()Õ¹ŒQ•Éµ¥¹…Ñ” ¤(€€€á¥Ð€À)¹‘Õ¹

Theres a better way to do it, I read that using continueloop the wrong way can make a loop to run infinity.

Edit:I dont need hotkeys, and will be nice if it can start runnig the script and then loop for periods of time to check again the states of main and side walk progs, thx again.

Now ony need to test it till it froze running normally :).

Edited by Ulizeus
Link to comment
Share on other sites

Global $Paused
HotKeySet("{END}", "TogglePause")
HotKeySet("{HOME}", "Terminate")

While 1
    Sleep(100)
WEnd
;here goes a line that check the last mdified time of the log, and return it in minutes
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused                ;after this, it check if the time in minutes > than a certain value
        sleep(100)
        ;here goes almost all the code of the script, mainly checking if the prog is frozen or the side prog is running
    WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

Dunno what happenend this the code again

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...