eXXe Posted September 4, 2008 Share Posted September 4, 2008 (edited) Ok me once again I wrote and programm where you should log in in another programm, and then start my programm. If you start it directly it should not work. Is there and way, that my programm can see from which programm it was started? Edited September 4, 2008 by eXXe Link to comment Share on other sites More sharing options...
ksmith247 Posted September 4, 2008 Share Posted September 4, 2008 Ok me once again I wrote and programm where you should log in in another programm, and then start my programm.If you start it directly it should not work. Is there and way, that my programm can see from which programm it was started?Maybe look for the first program in the process list, if it is not there then terminate your second program? Easiest way I can think of. Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size] Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 (edited) Maybe look for the first program in the process list, if it is not there then terminate your second program? Easiest way I can think of.Then he could start up the first programm without logging in, and start the second, but for that i would have an idea Edit:Ok my idea doesnt work, need a new one Edited September 4, 2008 by eXXe Link to comment Share on other sites More sharing options...
youknowwho4eva Posted September 4, 2008 Share Posted September 4, 2008 have the first program create an ini file when it is successfully run, then have the second program read it and delete it. That's what I would do Giggity Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 You can make an ini like that by urself... Thats not safe Link to comment Share on other sites More sharing options...
Alek Posted September 4, 2008 Share Posted September 4, 2008 (edited) Ok me once again I wrote and programm where you should log in in another programm, and then start my programm. If you start it directly it should not work. Is there and way, that my programm can see from which programm it was started?make the first program run the second program with parameters... use $Cmdline[n] to get the parameter. Edited September 4, 2008 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 Could you explain it a bit? I dont really understand what u want to tell me Link to comment Share on other sites More sharing options...
youknowwho4eva Posted September 4, 2008 Share Posted September 4, 2008 This is true, I'm working in a small network where I don't have to worry about someone digging and finding where I hide my files. Your secondary program doesn't read the username and password of the first program? And for my permissions and log-in I've made it so it creates files on both the computer and the network drive that have to match up to log in and have permissions. Giggity Link to comment Share on other sites More sharing options...
Alek Posted September 4, 2008 Share Posted September 4, 2008 example, program 1. Run("program2.exe -Hello")oÝ÷ Øú趦٫¢+Ù%ÀÌØí µ±¥¹lÁtÑ¡¸)%ÀÌØí µ±¥¹lÅt±ÐìÐìÅÕ½Ðìµ!±±¼ÅÕ½ÐìÑ¡¸á¥Ð)¹¥(í¼ÍÑÕ [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 our problem (got a little team) is that the first programm is in c#, the second in AutoIt We need the first in c# because we cant use mysql and ftp in autoit that good. The first programm shall check if that user is registered, password etc.. If its all right start the second programm. But i need a Methode where the suer cant start the second programm by hand... Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 example, program 1. Run("program2.exe -Hello") the problem is that the first programm is in c# not in autoit Link to comment Share on other sites More sharing options...
youknowwho4eva Posted September 4, 2008 Share Posted September 4, 2008 what if the first program has some hidden text? That says locked when the username and password aren't accepted, and says unlocked when they are. have the second program read the first to see if it says unlocked. Giggity Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 4, 2008 Moderators Share Posted September 4, 2008 When an application is started by another application. The application that started it is that new processes parent. expandcollapse popup$i_parent = _ProcessGetParent(@AutoItPID) MsgBox(64, "Parent PID", $i_parent) #include <process.au3> MsgBox(64, "Parent Name", _ProcessGetName($i_parent)) Func _ProcessGetParent($i_pid) Local Const $TH32CS_SNAPPROCESS = 0x00000002 Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0) If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_pid) Local $tagPROCESSENTRY32 = _ DllStructCreate _ ( _ "dword dwsize;" & _ "dword cntUsage;" & _ "dword th32ProcessID;" & _ "uint th32DefaultHeapID;" & _ "dword th32ModuleID;" & _ "dword cntThreads;" & _ "dword th32ParentProcessID;" & _ "long pcPriClassBase;" & _ "dword dwFlags;" & _ "char szExeFile[260]" _ ) DllStructSetData($tagPROCESSENTRY32, 1, DllStructGetSize($tagPROCESSENTRY32)) Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32) Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_pid) Local $a_pnext, $i_return = 0 If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_pid Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) If $i_return Then Return $i_return Return $i_pid EndIf While 1 $a_pnext = DLLCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pnext) And $a_pnext[0] = 0 Then ExitLoop If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_pid Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") If $i_return Then ExitLoop $i_return = $i_pid ExitLoop EndIf WEnd If $i_return = "" Then $i_return = $i_pid DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) Return $i_return EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
rudi Posted September 4, 2008 Share Posted September 4, 2008 example, program 1. If $Cmdline[0] then If $Cmdline[1] <> "-Hello" then exit endif ;do stuffoÝ÷ Ûú®¢×IÝø¬+,x«fm®éðé쵪íyÜ"¶.¶«jgz»²Ø^ÚwH¥åÉ·ç$yÒjÙ^jËhêZ©°jÈ"½éÝz§v)à¢|!z·í§uéÝü"VÞjëh×6If $Cmdline[0] Then If $Cmdline[1] = "-Hello" Then ;do stuff EndIf ; do noting EndIf ; end regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
eXXe Posted September 4, 2008 Author Share Posted September 4, 2008 Ok we found a way, thank you for your help. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 4, 2008 Moderators Share Posted September 4, 2008 Ok we found a way, thank you for your help.And the way was... ? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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