
Questions about DDE
#1
Guest_darkstar_*
Posted 31 March 2006 - 04:53 AM
#3
Guest_DDE_NEWBIE_*
Posted 31 March 2006 - 07:11 AM
#4
Posted 31 March 2006 - 03:44 PM
I have used it for Adobe stuff before, a sample would be:
#A = CLIENT.EXECUTE('Acrord32.exe','','','SW_SHOWMINNOACTIVE')
The PROiv properties pdf has some additional information on using this code that is, believe it or not, pretty helpful.
#5
Posted 31 March 2006 - 07:41 PM
//
// launch excel and open up the spreadsheet
//
$APP = 'EXCEL'
$TOPICS = ''
#STATUS = DDE_REQUEST($APP,'System','TOPICS',$TOPICS)
IF $TOPICS = '' THEN
#STATUS = CLIENT.Execute("excel.exe","","","SW_SHOWMAXIMIZED")
//
// check that excel has started, if not, wait a second and then try again (up to 10 times)
//
FOR #COUNTER = 1 TO 10
#STATUS = DDE_REQUEST($APP,'SYSTEM','TOPICS',$TOPICS)
IF $TOPICS = '' THEN
#SLEEP_TIME = CTIME(@TIME)
#SECONDS = CTIME('000001')
#SLEEP_TIME += #SECONDS
$SLEEP_TIME = CTIME(#SLEEP_TIME)
#SLEEP_DATE = @DATE
SLEEP($SLEEP_TIME,#SLEEP_DATE)
ELSE
#COUNTER = 10
ENDIF
ENDFOR
IF $TOPICS = '' THEN
UMSG('Could not start Excel',-1)
CALLEXIT()
ELSE
$CURRENT_TOPICS = ''
CALL 1
ENDIF
ELSE
//
$COMMAND = '[NEW(1,0,0)]'
#STAT = DDE_EXECUTE($APP,'SYSTEM',$COMMAND)
$CURRENT_TOPICS = $TOPICS
#STATUS = DDE_REQUEST($APP,'System','TOPICS',$TOPICS)
//
CALL 1
ENDIF
//
:1
$APP = 'EXCEL'
#LEN = LEN($TOPICS)
#START = 1
WHILE $LOOP_EXIT = ''
#END = INDEX($TOPICS(#START,#LEN),CHAR(9))
IF #END = 0 THEN
$TOPIC = $TOPICS(#START,#LEN)
IF INDEX($CURRENT_TOPICS,$TOPIC) ELSE
$LOOP_EXIT = 'Y'
ENDIF
ELSE
$TOPIC = $TOPICS(#START,#START + #END - 2)
IF INDEX($CURRENT_TOPICS,$TOPIC) THEN
#START += #END
IF #START >= #LEN
$LOOP_EXIT = 'Y'
ENDIF
ELSE
$LOOP_EXIT = 'Y'
ENDIF
ENDIF
ENDWHILE
IF $TOPIC = '' THEN
UMSG('Could Not Find Topic',-1)
CALLEXIT()
ELSE
......do the dde send stuff
ENDIF
#6
Posted 31 March 2006 - 07:44 PM
//
PARMS($SLEEP_TIME,#SLEEP_DATE)
//
$SLEEP_TIME = TRIM($SLEEP_TIME,':','A')
$SLEEP_TIME = $SLEEP_TIME + '000000'
$SLEEP_TIME = $SLEEP_TIME(1,6)
// #SLEEP_TIME = CTIME($SLEEP_TIME)
// $SLEEP_TIME = CTIME(#SLEEP_TIME)
//
IF #SLEEP_DATE = 0 THEN
#SLEEP_DATE = @DATE
ENDIF
//
IF #SLEEP_DATE < @DATE ELSE
IF CONV($SLEEP_TIME) < CONV(@TIME) AND #SLEEP_DATE = @DATE THEN
#SLEEP_DATE += 1
ENDIF
//
WHILE #SLEEP_DATE # @DATE
$SLEEP = 'Y'
ENDWHILE
//
WHILE CONV($SLEEP_TIME) > CONV(@TIME)
$SLEEP = 'Y'
ENDWHILE
ENDIF
#7
Posted 01 April 2006 - 06:47 AM
I would be carefull using that SLEEP Global Logic, it uses up 100% of a CPU since its stuck in a WHILE loop.
This would kill a system if there were lots of users executing it....
Putting in a UMSG("",1) would be better, as this makes the CPU sleep correctly so that it does not take up CPU cycles.
Rob D.
#8
Posted 02 April 2006 - 07:10 AM
I am afraid darkstart did mention he is using 4.6 so he can't use CLIENT command.
My experience #STAT = SYSTEM('GUI WINDOW ASYNC EXCLE') should start Excel and the subsequent DDE_POKE should do the job beautifully. I never come across CONV_NOT_ESTABLISHED before though.
Regards,
Vol
#9
Guest_darkstar_*
Posted 02 April 2006 - 11:56 PM
#10
Guest_darkstar_*
Posted 03 April 2006 - 01:03 AM
Sorry about that. Was just browsing rubyeye's thread on PROIV Modifications and got the names confused. Thanks for the tip, DDE_NEWBIE.Regarding rubyeye's advice, surprisingly, if I just ignore the error message after checking if Excel is Ready, the DDE_POKE works just fine.
#11
Guest_DDE_NEWBIE_*
Posted 03 April 2006 - 06:20 AM
#12
Posted 04 April 2006 - 03:59 PM
Try:Any way to auto resize the cells through DDE?
* Select the first 100 columns
$CMD = '[SELECT("C1:C100")]'
#S = DDE_EXECUTE('EXCEL','SYSTEM',$CMD)
* Set the size for the column to the max cell size for the column
$V = '[COLUMN.WIDTH(,,,3,1)]'
#S = DDE_EXECUTE('EXCEL','SYSTEM',$V)
HTH,
AK
#13
Guest_DDE_NEWBIE_*
Posted 05 April 2006 - 06:50 AM
#14
Posted 05 April 2006 - 07:28 PM
Darkstar,Just in case anyone is wondering, I've already used the
#STAT = SYSTEM('GUI ASYNC START PROGRAM')
command with the same results
There would appear to be many different ways to call Excel from ProIV. We use a variation of your SYSTEM call that has not given us any problems, to date.
Darren touched on an important point, in his attached code, that I have not heard you mention anything about. That is, are you giving Excel enough time to fully open before trying to converse with it. You mentioned that once Excel has opened, all your POKES work without error. Perhaps the reason you're getting a DMLERR_NO_CONV_ESTABLISHED error is that you are trying to issue commands to Excel before it's ready to accept any commands.
We've used the following code for years without any problems:
* Start Excel
#S = SYSTEM('GUI /C START EXCEL')
* Pause to make sure Excel fully launches on slow/old computers
UMSG('Starting Excel',3)
HTWorks,
AK
#15
Guest_Darkstar_*
Posted 06 April 2006 - 12:19 AM
DDE_Request for Status
If (Status # 'Ready') then
Start Excel with no worksheets and no splash screen (using /E parameter)
Pause for 10 seconds (Using something similar to the above)
Endif
Create a new sheet
Select the sheet and generate all the neccessary pointers (sheet name, etc)
Check for DDE_error
It's the last (check for DDE error) that's giving me a problem. As far as I can see, all the statements prior to it work flawlessly, yet the error always occurs. If, as DDE_NEWBIE stated, I just skipped the error message, it works okay, but that error message really troubles me. After all, error messages are there for a reason, right?
Reply to this topic

0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users