Jump to content


Click the link below to see the new game I'm developing!


- - - - -

Questions about DDE


16 replies to this topic

#1 Guest_darkstar_*

Guest_darkstar_*
  • Guests

Posted 31 March 2006 - 04:53 AM

I have a function that uses Excel to generates graphs. It works all well and good with one exception: Excel HAS to be activated BEFORE logging in into PROIV. If not, the dreaded CONV_NOT_ESTABLISHED shows up. I've tried calling EXCEL from within PROIV, but even though the program can be started within PROIV, the message CONV_NOT_ESTABLISHED always appears. Can anyone confirm if this is a limitation or if I'm doing something wrong? I'm using version 4.6, so the CLIENT commands can't be used.

#2 Guest_darkstar_*

Guest_darkstar_*
  • Guests

Posted 31 March 2006 - 05:13 AM

Just in case anyone is wondering, I've already used the

#STAT = SYSTEM('GUI ASYNC START PROGRAM')

command with the same results

#3 Guest_DDE_NEWBIE_*

Guest_DDE_NEWBIE_*
  • Guests

Posted 31 March 2006 - 07:11 AM

I've got the same error several times. I assume that you check whether there's an error then exit if there is an error? I've noticed that if I were to IGNORE this error, the function just goes on as normal. Here's the wierd part......If you were to create a graph AND a report simultaenously, the report tuns out fine (via wordpad) but the graph just.....doesn't show up.

#4 NeilIV

NeilIV

    Member

  • Members
  • PipPip
  • 28 posts
  • Gender:Male

Posted 31 March 2006 - 03:44 PM

Have you tried using the client.execute code?

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 DARREN

DARREN

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 396 posts
  • Gender:Male
  • Location:Florida,USA

Posted 31 March 2006 - 07:41 PM

Thsi should do it...you may have to modiy the value for the New command to create a graph instead of standard spreadsheet (can't remember the number)

//
// 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
Things should be made as simple as possible, but not simpler

#6 DARREN

DARREN

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 396 posts
  • Gender:Male
  • Location:Florida,USA

Posted 31 March 2006 - 07:44 PM

Forgot to add that SLEEP is a global logic that is included in the standard PROIV demo functions

//
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
Things should be made as simple as possible, but not simpler

#7 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,652 posts
  • Gender:Male
  • Location:Spain

Posted 01 April 2006 - 06:47 AM

Hi,

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 Vol Yip

Vol Yip

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 393 posts
  • Gender:Male
  • Location:Hong Kong

Posted 02 April 2006 - 07:10 AM

All,

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_*

Guest_darkstar_*
  • Guests

Posted 02 April 2006 - 11:56 PM

My apologies to Vol Yip. I meant DMLERR_NO_CONV_ESTABLISHED (was writing off the top of my head there). Regarding rubyeye's advice, surprisingly, if I just ignore the error message after checking if Excel is Ready, the DDE_POKE works just fine. However, the system still returns an error message. Any idea why? Thanks for all the replies

#10 Guest_darkstar_*

Guest_darkstar_*
  • Guests

Posted 03 April 2006 - 01:03 AM

Regarding rubyeye's advice, surprisingly, if I just ignore the error message after checking if Excel is Ready, the DDE_POKE works just fine.

Sorry about that. Was just browsing rubyeye's thread on PROIV Modifications and got the names confused. Thanks for the tip, DDE_NEWBIE.

#11 Guest_DDE_NEWBIE_*

Guest_DDE_NEWBIE_*
  • Guests

Posted 03 April 2006 - 06:20 AM

I'm not sure about the error message. Seems to me as though even if there's an error reported, the link between PROIV and Excel seems to be fine. On that note, any one know how to solve this little problem? If I were to input "THIS A REALLY LONG STRING" through DDE, the default cell size limits the user's view. Any way to auto resize the cells through DDE?

#12 andykay

andykay

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 204 posts
  • Gender:Male
  • Location:Cyberspace...looking for work

Posted 04 April 2006 - 03:59 PM

Any way to auto resize the cells through DDE?

Try:

* 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
THE LIGHT AT THE END OF THE TUNNEL IS THE HEADLAMP OF THE TRAIN THAT'S ABOUT TO HIT YOU!!!

#13 Guest_DDE_NEWBIE_*

Guest_DDE_NEWBIE_*
  • Guests

Posted 05 April 2006 - 06:50 AM

Thanks for the help, andykay! The commands worked beautifully. Back to the main topic though. Anyone know WHY the error message is showing up? If I'm not wrong, darkstar's probably got the same problem I've faced: After calling Excel from within PROIV, either a dde_request for status or dde_last_error will return an error message

#14 andykay

andykay

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 204 posts
  • Gender:Male
  • Location:Cyberspace...looking for work

Posted 05 April 2006 - 07:28 PM

Just in case anyone is wondering, I've already used the

#STAT = SYSTEM('GUI ASYNC START PROGRAM')

command with the same results

Darkstar,

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
THE LIGHT AT THE END OF THE TUNNEL IS THE HEADLAMP OF THE TRAIN THAT'S ABOUT TO HIT YOU!!!

#15 Guest_Darkstar_*

Guest_Darkstar_*
  • Guests

Posted 06 April 2006 - 12:19 AM

I think I better be a bit more specific about my code. It goes something like this:

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

Click the link below to see the new game I'm developing!